| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Brijesh Shrivastav <Bshrivastav(at)esri(dot)com> |
| Cc: | "Pglibpq (E-mail)" <pgsql-interfaces(at)postgresql(dot)org> |
| Subject: | Re: Filtering tables based on user privileges |
| Date: | 2004-06-16 02:57:44 |
| Message-ID: | 16049.1087354664@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-interfaces |
Brijesh Shrivastav <Bshrivastav(at)esri(dot)com> writes:
> After researching again I have come with following syntax to select all
> table with specific privilege (SELECT/INSERT/UPDATE..)to current user.
> SELECT relname
> FROM pg_class
> WHERE pg_table_is_visible(oid)
> AND relname !~ '^pg_'
> AND has_table_privilege (oid,'INSERT');
> Is this the best way to do it?
You likely also want to filter on relkind, but something about like this
is probably a reasonable starting point.
> Is there any way to execute such
> a statement for any user?
Sure, see the three-parameter variants of has_table_privilege.
> In this case such queries will most
> likely be executed by a super user.
A superuser will always be considered to have all privileges,
so the has_table_privilege filter will be a no-op for such a one.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Paul Tilles | 2004-06-16 13:38:49 | ecpg Informix compatability changes for Version 7.4.3 |
| Previous Message | Brijesh Shrivastav | 2004-06-15 22:51:26 | Re: Filtering tables based on user privileges |