Re: [GENERAL] Recursive row level security policy - Mailing list pgsql-general

From Stephen Frost
Subject Re: [GENERAL] Recursive row level security policy
Date
Msg-id 20161217190427.GQ18360@tamriel.snowman.net
Whole thread Raw
In response to Re: [GENERAL] Recursive row level security policy  (Simon Charette <charette.s@gmail.com>)
List pgsql-general
Simon,

* Simon Charette (charette.s@gmail.com) wrote:
> Ahh makes sense, thanks for the explanation!
>
> I was assuming USING() clauses were executed in the context of the
> owner of the policy, by passing RLS.

No, as with views, a USING() clause is executed as the caller not the
owner of the relation.  Security Definer functions can be used to
execute actions in the policy as another user.

Note that RLS won't be applied for the table owner either (unless the
relation has 'FORCE RLS' enabled for it), so you don't have to have
functions which are run as superuser to use the approach Joe
recommended.

Thanks!

Stephen

Attachment

pgsql-general by date:

Previous
From: Simon Charette
Date:
Subject: Re: [GENERAL] Recursive row level security policy
Next
From: Joe Conway
Date:
Subject: Re: [GENERAL] Recursive row level security policy