RLS with check option - surprised design

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: RLS with check option - surprised design
Date: 2014-10-05 10:30:52
Message-ID: CAFj8pRBbD-AiWuJ6vLZA7KHYvtd_E23LYfRwMgJjtv90W=Ym7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

I am playing with RLS. I created simple table

table_data (inserted_by text, v integer);

I created two policies

create policy p1 on data with check (inserted_by = session_user);
create policy p2 on data with check (v between 10 and 1000);

I was surprised so p2 effectively disables p1;

next a message:

ERROR: new row violates WITH CHECK OPTION for "data"
DETAIL: Failing row contains (2014-10-05 12:28:30.79652, petr, 1000).

Doesn't inform about broken policy.

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ali Akbar 2014-10-05 10:39:37 Re: Add generate_series(numeric, numeric)
Previous Message Ali Akbar 2014-10-05 08:21:47 Re: Add generate_series(numeric, numeric)