Re: how to check specific user_name have “SELECT ON ALL TABLES IN SCHEMA <tableschema>” privilege or not ?

From: Joe Conway <mail(at)joeconway(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, yanliang lei <msdnchina(at)163(dot)com>
Cc: PostgreSQL-general <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: how to check specific user_name have “SELECT ON ALL TABLES IN SCHEMA <tableschema>” privilege or not ?
Date: 2022-09-12 19:23:38
Message-ID: 9be5eea1-0630-f14a-aeb0-1d30365f4b20@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-general

On 9/11/22 12:03, David G. Johnston wrote:
> On Sunday, September 11, 2022, yanliang lei <msdnchina(at)163(dot)com
> <mailto:msdnchina(at)163(dot)com>> wrote:
>
> Dear everyone,
> how to check specific <user_name>  have “SELECT ON ALL TABLES IN
> SCHEMA <tableschema>”  privilege or not ?
>
>
> This is not an appropriate list to ask general usage questions.  We have
> a -general list for those.

(therefore moving thread to pgsql-general)

> But, that isn’t a privilege.  Its a grant action.  The privilege is just
> select on a table in a schema.  So you have to check every table in the
> schema individually.  The functions and the catalogs documented to
> retrieve this information - start putting them together into a query.
> I’m unable to go look for the specific details right now.

For an extension that will help you with this, see
https://github.com/CrunchyData/crunchy_check_access
Either use that directly, or see how it gathers the info you are
interested in:

https://github.com/CrunchyData/crunchy_check_access/blob/master/sql/check_access.sql

HTH,

--
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message yanliang lei 2022-09-14 09:41:30 suggest about bpchar data type in the document
Previous Message Noah Misch 2022-09-12 04:46:47 Re: SQL-standard function bodies and creating SECURITY DEFINER routines securely

Browse pgsql-general by date

  From Date Subject
Next Message Bryn Llewellyn 2022-09-12 22:51:23 Is it possible to stop sessions killing eachother when they all authorize as the same role?
Previous Message shashidhar Reddy 2022-09-12 18:05:38 Re: unable to install pldebugger