Check if SELECT is granted

Started by Poul Møller Hansenover 20 years ago5 messagesgeneral
Jump to latest
#1Poul Møller Hansen
freebsd@pbnet.dk

I'm wondering if it's possible for the ordinary user to check if SELECT
is granted on a give table, without doing the select ?

I want to use it in an application with a menu structure, where I only
want to enable those options where SELECT on a the tables used in the
given menu is granted.
Instead of keeping track on it in a separate table.

Thanks,
Poul

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Poul Møller Hansen (#1)
Re: Check if SELECT is granted

=?UTF-8?B?UG91bCBNw7hsbGVyIEhhbnNlbg==?= <freebsd@pbnet.dk> writes:

I'm wondering if it's possible for the ordinary user to check if SELECT
is granted on a give table, without doing the select ?

See the has_table_privilege() function.

regards, tom lane

#3Poul Møller Hansen
freebsd@pbnet.dk
In reply to: Tom Lane (#2)
Re: Check if SELECT is granted

See the has_table_privilege() function.

Thanks, but how does it work ?

select has_table_privelege('public.mytable', 'select');
ERROR: function has_table_privelege("unknown", "unknown") does not exist
HINT: No function matches the given name and argument types. You may
need to add explicit type casts.

Poul

#4Michael Fuhr
mike@fuhr.org
In reply to: Poul Møller Hansen (#3)
Re: Check if SELECT is granted

On Fri, Sep 02, 2005 at 10:39:14PM +0200, Poul M�ller Hansen wrote:

See the has_table_privilege() function.

Thanks, but how does it work ?

select has_table_privelege('public.mytable', 'select');
ERROR: function has_table_privelege("unknown", "unknown") does not exist
HINT: No function matches the given name and argument types. You may
need to add explicit type casts.

It helps if you spell "privilege" correctly ;-)

--
Michael Fuhr

#5Poul Møller Hansen
freebsd@pbnet.dk
In reply to: Michael Fuhr (#4)
Re: Check if SELECT is granted

It helps if you spell "privilege" correctly ;-)

Thanks, stupud mistake ... :)

Poul