Search Postgresql Archives

PSQLException exception when dropping database and calling has_database_privilege: ERROR: database "test_1" does not exist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux