Thread: permissions from system catalogs

permissions from system catalogs

From
Kyle Bateman
Date:
Can anyone point me where to look in the system catalogs (or information 
schema) to determine in advance whether a given user (or the current 
user) will have select permission to a given table or view?

Kyle



Re: permissions from system catalogs

From
Tom Lane
Date:
Kyle Bateman <kyle@actarg.com> writes:
> Can anyone point me where to look in the system catalogs (or information 
> schema) to determine in advance whether a given user (or the current 
> user) will have select permission to a given table or view?

Try has_table_privilege()

http://www.postgresql.org/docs/8.1/static/functions-info.html
        regards, tom lane


Re: permissions from system catalogs

From
Michael Fuhr
Date:
On Mon, Jun 26, 2006 at 05:30:12PM -0600, Kyle Bateman wrote:
> Can anyone point me where to look in the system catalogs (or information 
> schema) to determine in advance whether a given user (or the current 
> user) will have select permission to a given table or view?

An easy way is to use the has_table_privilege() function.  See also
information schema views whose names contain the word "grants" or
"privileges."

http://www.postgresql.org/docs/8.1/interactive/functions-info.html#FUNCTIONS-INFO-ACCESS-TABLE
http://www.postgresql.org/docs/8.1/interactive/information-schema.html

(Adjust the version number in the above links if you're using a
version other than 8.1)

-- 
Michael Fuhr