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

Поиск
Список
Период
Сортировка
От Yandong Yao
Тема PSQLException exception when dropping database and calling has_database_privilege: ERROR: database "test_1" does not exist
Дата
Msg-id CA+ZQTxqC0wzLu=Wh+mo8md3M5Ja587wzMGobP_P6z4aLE8iQrA@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Dickson S. Guedes"
Дата:
Сообщение: Re: how to install 9.1 on non-graphical server?
Следующее
От: e-blokos
Дата:
Сообщение: about synchronous_standby_names or sync replic