Re: INSERT ... ON CONFLICT UPDATE and RLS

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: INSERT ... ON CONFLICT UPDATE and RLS
Дата
Msg-id CAM3SWZTZV+okAm_23A5u0CLdYSD+CFEqzmUoWdoN_ggHQjGS3Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: INSERT ... ON CONFLICT UPDATE and RLS  (David Fetter <david@fetter.org>)
Ответы Re: INSERT ... ON CONFLICT UPDATE and RLS  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-hackers
On Wed, Jan 7, 2015 at 5:33 PM, David Fetter <david@fetter.org> wrote:
> Same database, same constraints, different outcome.

You're missing the point, I think. UPSERT means that the user doesn't
care about whether or not a given tuple proposed for insertion was
handled with an insert or an update. If you have distinct INSERT and
UPDATE policies (not that I think that many people will), and if they
differ in such a way as to make the difference between some actual
INSERT ... ON CONFLICT UPDATE in the app throwing an error or not
throwing an error depending only on whether the UPDATE (or INSERT)
path was taken, then that combination (the combination of that UPSERT
command, that UPDATE policy and that INSERT policy) is wrong-headed.
It's not based on some particular set of data in the database, but any
and all possible sets. Stephen's objection isn't that the update
operation throws an error; it's that the insert doesn't. I'm with
Stephen; ISTM that selectively enforcing RLS like that is a foot gun.
For column level privileges, you wouldn't expect to only get an error
about not having the relevant update permissions at runtime, when the
update path happens to be taken. And so it is for RLS.

-- 
Peter Geoghegan



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ali Akbar
Дата:
Сообщение: Re: [REVIEW] Re: Fix xpath() to return namespace definitions
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Possible typo in create_policy.sgml