Re: Does the current user have UPDATE privilege on FOO?
От | Lionel Elie Mamane |
---|---|
Тема | Re: Does the current user have UPDATE privilege on FOO? |
Дата | |
Msg-id | 20120228040224.GA32207@capsaicin.mamane.lu обсуждение исходный текст |
Ответ на | Re: Does the current user have UPDATE privilege on FOO? (Mike Blackwell <mike.blackwell@rrd.com>) |
Список | pgsql-general |
On Mon, Feb 27, 2012 at 12:11:23PM -0600, Mike Blackwell wrote: > On Mon, Feb 27, 2012 at 11:00, Lionel Elie Mamane <lionel@mamane.lu> wrote: >> I'm trying to understand the "clean" way to determine whether the >> current role has UPDATE (or SELECT or DELETE or UPDATE) privileges on >> a specific table (or column). If I can do it in a way that is portable >> across different DBMSs, even better :) > For PostgreSQL only, see > http://www.postgresql.org/docs/9.1/interactive/functions-info.html for a > list of functions for this. Ah yes, so basically I can implement the JDBC-alike getTablePrivileges as something like: SELECT (...), tables.table_name, pr.rolname AS grantee, has_table_privilege(pr.oid, tables.table_schema, + '.' + tables.table_name, privilege.name), (...) FROM information_schema.tables, pg_catalog.pg_roles pr, VALUES ('SELECT', 'UPDATE', ...) AS privilege I'd be missing a sensible value for the grantor column, but at least it would be complete and robust for the rest of the information. Thanks for the pointer. -- Lionel
В списке pgsql-general по дате отправления: