Hi Guys, I have an application which will call following SQL code to retrieve roles privileges on all databases in one server instance:
SELECT r.rolname, d.datname, has_database_privilege(r.oid, d.oid, 'CONNECT') connectable, has_database_privilege(r.oid, d.oid, 'CREATE') creatable FROM pg_catalog.pg_roles r, pg_catalog.pg_database d WHERE datname != 'postgres' AND datistemplate is false AND rolname IN ('role1', 'role2', 'role3') While above code will report PSQLException exception: ERROR: database "test_1" does not exist if one of database is dropping by other scripts. How could i avoid this kind of exception? or is it any better way to get many users privilege on database objects such as schema, table and columns instead of calling has_***_privilege. I am using PostgreSQL 8.4. Thanks very much in advance! Yandong