Re: RLS Design - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: RLS Design
Date
Msg-id 877g0yor92.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: RLS Design  ("Brightwell, Adam" <adam.brightwell@crunchydatasolutions.com>)
List pgsql-hackers
>>>>> "Adam" == Brightwell, Adam <adam.brightwell@crunchydatasolutions.com> writes:
Adam> At any rate, this appears to be a previously existing issueAdam> with WITH CHECK OPTION.  Thoughts?

It's definitely an existing issue; you can reproduce it more simply,
no need to mess with different users.

The issue as far as I can tell is that the withCheckOption exprs are
not being processed anywhere in setrefs.c, so it only works at all by
pure fluke: for most operators, the opfuncid is also filled in by
eval_const_expressions, but for whatever reason SAOPs escape this
treatment. Same goes for other similar cases:

create table colors (name text);
create view vc1 as select * from colors where name is distinct from 'grue' with check option;
create view vc2 as select * from colors where name in ('red','green','blue') with check option;
create view vc3 as select * from colors where nullif(name,'grue') is null with check option;

insert into vc1 values ('red'); -- fails
insert into vc2 values ('red'); -- fails
insert into vc3 values ('red'); -- fails

(Also, commands/policy.c has two instances of "const char" as a
function return type, which is a compiler warning since the "const" is
meaningless.)

-- 
Andrew (irc:RhodiumToad)



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Support for N synchronous standby servers
Next
From: Amit Kapila
Date:
Subject: Re: pg_background (and more parallelism infrastructure patches)