Re: Bug: RLS policy FOR SELECT is used to check new rows

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: Bug: RLS policy FOR SELECT is used to check new rows
Дата
Msg-id CAEZATCV+-U24XXRZ5jy1+pP_Y8KgxhR_8CaHLfi-dpQkUwsjRQ@mail.gmail.com
обсуждение исходный текст
Ответ на Bug: RLS policy FOR SELECT is used to check new rows  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: Bug: RLS policy FOR SELECT is used to check new rows  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, 24 Oct 2023 at 09:36, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>
> I'd say that this error is wrong.  The FOR SELECT policy should be applied
> to the WHERE condition, but certainly not to check new rows.
>

Yes, I had the same thought recently. I would say that the SELECT
policies should only be used to check new rows if the UPDATE has a
RETURNING clause and SELECT permissions are required on the target
relation.

In other words, it should be OK to UPDATE a row to new values that are
not visible according to the table's SELECT policies, provided that
the UPDATE command does not attempt to return those new values. That
would be consistent with what we do for INSERT.

Note, that the current behaviour goes back a long way, though it's not
quite clear whether this was intentional [1].

[1] https://github.com/postgres/postgres/commit/7d8db3e8f37aec9d252353904e77381a18a2fa9f

Regards,
Dean



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

Предыдущее
От: "Drouvot, Bertrand"
Дата:
Сообщение: Re: Synchronizing slots from primary to standby
Следующее
От: Michał Kłeczek
Дата:
Сообщение: A case for GIST supporting ORDER BY