Change join to pg_user to a left join, as the database may be owned by a role.
authorGreg Sabino Mullane <[email protected]>
Wed, 23 Nov 2011 14:13:46 +0000 (09:13 -0500)
committerGreg Sabino Mullane <[email protected]>
Wed, 23 Nov 2011 14:13:46 +0000 (09:13 -0500)
Thanks to Emmanuel Lesouef for the bug report and help in tracking this down.
There are probably other incorrect inner joins to pg_user in the code.

check_postgres.pl

index 622c5d437f5cdc5f2760cd5bbe253c761b8a9476..3b5852365daebedb7b7ad01b4496bbf502f2e45c 100755 (executable)
@@ -3978,7 +3978,7 @@ SELECT pg_database_size(d.oid) AS dsize,
   datname,
   usename
 FROM pg_database d
-JOIN pg_user u ON (u.usesysid=d.datdba)$USERWHERECLAUSE
+LEFT JOIN pg_user u ON (u.usesysid=d.datdba)$USERWHERECLAUSE
 };
     if ($opt{perflimit}) {
         $SQL .= " ORDER BY 1 DESC LIMIT $opt{perflimit}";