Row Level Security Policy Name in Error Message

Started by Louis Tianabout 3 years ago2 messagesgeneral
Jump to latest
#1Louis Tian
louis.tian@aquamonix.com.au

Hi All,

Wondering whether there is a way to get the row-level security policy name in the error message when it's violated.
I am only getting a more generic error message like this.
ERROR: new row violates row-level security policy for table "table_name"

Thanks for your help.

Regards,
Louis Tian

#2Daniel Gustafsson
daniel@yesql.se
In reply to: Louis Tian (#1)
Re: Row Level Security Policy Name in Error Message

On 6 Mar 2023, at 01:18, Louis Tian <louis.tian@aquamonix.com.au> wrote:

Wondering whether there is a way to get the row-level security policy name in the error message when it's violated.
I am only getting a more generic error message like this.
ERROR: new row violates row-level security policy for table "table_name"

If memory serves me right. The name will be included in the error message in
case the operation violated a specific restrictive policy. If no permissive
policy was found that would allow the operation then the error message will be
what you saw without a policy name (since none was explicitly violated).

--
Daniel Gustafsson