Re: unclear about row-level security USING vs. CHECK - Mailing list pgsql-hackers

From Adam Brightwell
Subject Re: unclear about row-level security USING vs. CHECK
Date
Msg-id CAKRt6CR2MLx4fYMLnMPT_P4y3bA+j9QDX976GpUqa5O4r89rtw@mail.gmail.com
Whole thread Raw
In response to Re: unclear about row-level security USING vs. CHECK  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
> My vote would be to keep it as-is.

Same for me.

> It feels perfectly natural to me. USING clauses add to the query's
> WHERE clause controlling which existing rows you can SELECT, UPDATE or
> DELETE. WITH CHECK clauses control what new data you can add via
> INSERT or UPDATE. UPDATE allows both, but most of the time I expect
> you'll want them to be the same.

I agree.  In the current uses cases I have been experimenting with,
this approach has made the most sense.

> So having the WITH CHECK clause default to being the same as the USING
> clause for UPDATE matches what I expect to be the most common usage.

I agree.

> Users granted permission to update a subset of the table's rows
> probably don't want to give those rows away. More advanced use-cases
> are still supported, but the simplest/most common case is the default,
> which means that you don't have to supply the same expression twice.

Yes, I agree.  IMO, having to supply the same expression twice just
seems cumbersome and unnecessary.  While I'd certainly agree that
documentation could always be improved, I have found the current
behavior to be fairly intuitive and easily understood by most (if not
all) DBA's I have spoken with about it.

-Adam

-- 
Adam Brightwell - adam.brightwell@crunchydatasolutions.com
Database Engineer - www.crunchydatasolutions.com



pgsql-hackers by date:

Previous
From: Stanislav Kelvich
Date:
Subject: Box type equality
Next
From: Andres Freund
Date:
Subject: Re: ON CONFLICT issues around whole row vars,