Row security violation error is misleading

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Row security violation error is misleading
Дата
Msg-id CAMsr+YHS9=nnt6Tqq7Lq14oncSisEC2oseOq+8K6HY+tmSiKKw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Row security violation error is misleading  (Stephen Frost <sfrost@snowman.net>)
Re: Row security violation error is misleading  (Peter Geoghegan <pg@heroku.com>)
Re: Row security violation error is misleading  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
When attempting to insert a row that violates a row security policy that applies to writes, the error message emitted references WITH CHECK OPTION, even though (as far as the user knows) there's no such thing involved.
If you understand the internals you'd know that row security re-uses the same logic as WITH CHECK OPTION, but it's going to be confusing for users.

postgres=> INSERT INTO clients (account_name, account_manager) VALUES ('peters', 'peter'), ('johannas', 'johanna');
ERROR:  44000: new row violates WITH CHECK OPTION for "clients"
DETAIL:  Failing row contains (7, johannas, johanna).
LOCATION:  ExecWithCheckOptions, execMain.c:1683


... yet "clients" is a table, not a view, and cannot have a WITH CHECK OPTION clause.

There is no reference to the policy being violated or to the fact that it's row security involved.

I think this is going to be very confusing for users. I was expecting to see something more like:

ERROR:  44000: new row in table 'clients' violates row level security policy 'just_own_clients'


Re-using the SQLSTATE 44000 is a bit iffy too. We should probably define something to differentiate this, like:

   44P01 ROW SECURITY WRITE POLICY VIOLATION



(I've finally found some time to try to review the user-facing side of the row security patch as-committed).


--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: PATCH: Add 'pid' column to pg_replication_slots
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Assertion failure when streaming logical changes