pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to grant read only functions execute permission to read only user
3+ messages / 3 participants
[nested] [flat]

* How to grant read only functions execute permission to read only user
@ 2023-07-17 14:11  Yi Sun <yinan81@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Yi Sun @ 2023-07-17 14:11 UTC (permalink / raw)
  To: PostgreSQL General <pgsql-general@lists.postgresql.org>

Hello guys,

Our read only user is okay to be granted read only permission of tables.

How to grant read only functions execute permission to read only user, is
there a simple way to do it please? If not, how to get the list of read
only functions please? Then can grant one by one based on the list, thanks

Best regards
Dennis Sun

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to grant read only functions execute permission to read only user
@ 2023-07-17 15:43  Tomas Vondra <tomas.vondra@enterprisedb.com>
  parent: Yi Sun <yinan81@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tomas Vondra @ 2023-07-17 15:43 UTC (permalink / raw)
  To: Yi Sun <yinan81@gmail.com>; PostgreSQL General <pgsql-general@lists.postgresql.org>



On 7/17/23 16:11, Yi Sun wrote:
> Hello guys,
> 
> Our read only user is okay to be granted read only permission of tables.
> 
> How to grant read only functions execute permission to read only user,
> is there a simple way to do it please? If not, how to get the list of
> read only functions please? Then can grant one by one based on the list,
> thanks

What is read-only function? I don't think Postgres has anything like
that. Functions inherit the privileges of the user that executes them by
default. So if the user is read-only (i.e. has just SELECT privilege),
then the function can't do any writes either.


regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to grant read only functions execute permission to read only user
@ 2023-07-17 15:49  David G. Johnston <david.g.johnston@gmail.com>
  parent: Tomas Vondra <tomas.vondra@enterprisedb.com>
  0 siblings, 0 replies; 3+ messages in thread

From: David G. Johnston @ 2023-07-17 15:49 UTC (permalink / raw)
  To: Tomas Vondra <tomas.vondra@enterprisedb.com>; +Cc: Yi Sun <yinan81@gmail.com>; PostgreSQL General <pgsql-general@lists.postgresql.org>

On Mon, Jul 17, 2023, 08:44 Tomas Vondra <tomas.vondra@enterprisedb.com>
wrote:

>
>
> On 7/17/23 16:11, Yi Sun wrote:
> > Hello guys,
> >
> > Our read only user is okay to be granted read only permission of tables.
> >
> > How to grant read only functions execute permission to read only user,
> > is there a simple way to do it please? If not, how to get the list of
> > read only functions please? Then can grant one by one based on the list,
> > thanks
>
> What is read-only function? I don't think Postgres has anything like
> that. Functions inherit the privileges of the user that executes them by
> default. So if the user is read-only (i.e. has just SELECT privilege),
> then the function can't do any writes either.
>
>
>
By definition any function marked stable or immutable is read-only though
the system doesn't enforce that user-specified label.

David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2023-07-17 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17 14:11 How to grant read only functions execute permission to read only user Yi Sun <yinan81@gmail.com>
2023-07-17 15:43 ` Tomas Vondra <tomas.vondra@enterprisedb.com>
2023-07-17 15:49   ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox