Skip to content

Commit bd80c54

Browse files
committed
Fix comment detection
On psql 8.1, `pg_catalog.shobj_description` does not exist. Also, if the database to comment is not the current db then this warning will be raised and the comment will not be applied: `WARNING: database comments may only be applied to the current database` This fix uses the pg_* databases to find the comment based on the database oid rather than the shared object description function.
1 parent d42b821 commit bd80c54

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

manifests/server/database.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
if $comment {
8181
Exec[ $createdb_command ]->
8282
postgresql_psql {"COMMENT ON DATABASE ${dbname} IS '${comment}'":
83-
unless => "SELECT pg_catalog.shobj_description(d.oid, 'pg_database') as \"Description\" FROM pg_catalog.pg_database d WHERE datname = '${dbname}' AND pg_catalog.shobj_description(d.oid, 'pg_database') = '${comment}'",
83+
unless => "SELECT description FROM pg_description JOIN pg_database ON objoid = pg_database.oid WHERE datname = '${dbname}' AND description = '${comment}'",
84+
db => $dbname,
8485
}
8586
}
8687

0 commit comments

Comments
 (0)