Re: Multi-tenancy with RLS - Mailing list pgsql-hackers

From Haribabu Kommi
Subject Re: Multi-tenancy with RLS
Date
Msg-id CAJrrPGe9=KvDyk5T0Y942egGeTP7QwpYoig0mfzi=SfU6mH_Nw@mail.gmail.com
Whole thread Raw
In response to Re: Multi-tenancy with RLS  (Haribabu Kommi <kommi.haribabu@gmail.com>)
Responses Re: Multi-tenancy with RLS
List pgsql-hackers
On Mon, Jan 4, 2016 at 10:43 PM, Haribabu Kommi
<kommi.haribabu@gmail.com> wrote:
> On Mon, Jan 4, 2016 at 8:34 PM, Amit Langote
> <Langote_Amit_f8@lab.ntt.co.jp> wrote:
>>
>> I tried your latest patch to see what may have caused the infinite
>> recursion. The recursion occurs during backend startup itself, right?
>>
>> ISTM, doing transformWhereClause during RelationCacheInitializePhase3()
>> would not work. Things like operators, functions within the policy qual
>> require namespace lookup which down the line would call
>> RelationBuildRowSecurity for pg_namespace build and so on thus causing the
>> infinite recursion. Perhaps, it would have to be done in a separate phase
>> after the phase 3 but I'm not sure.
>
> Thanks for the test. Yes, the issue happens at backend startup itself.
> I will give a try by separating the initialization of security
> policies after init phase 3.

Here I attached updated patches with the fix of infinite recursion in
RelationBuildRowSecurity function by checking with a variable that
whether the build row security is already in progress for a system
relation or not. If it is already in progress for a relation, then it doesn't
build the row security description for this relation.

Regards,
Hari Babu
Fujitsu Australia

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_conversion seems rather strangely defined
Next
From: Tom Lane
Date:
Subject: Re: Add schema-qualified relnames in constraint error messages.