PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16006
PG Version9.5.19
OSUbuntu 16.04.6 LTS
Opened2019-09-12 16:51:01+00
Reported byVinay Banakar
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16006
Logged by:          Vinay Banakar
Email address:      (redacted)
PostgreSQL version: 9.5.19
Operating system:   Ubuntu 16.04.6 LTS
Description:        

Update queries fail on a table having any policy with a function that takes
a whole-row var as argument:

I stumbled upon this after I had enabled RLS on a table and have a policy
that basically raises every row read to log at INFO level (a quick hack for
benchmarking).

Table:
create table usertable(key VARCHAR PRIMARY KEY,field0 text,field1
text,field2 text,field3 text,field4 text,field5 text,field6 text,field7
text,field8 text,field9 text,timestamp timestamp NOT NULL DEFAULT NOW());

# This policy is to raise a row to INFO log when an operation is made on
that.
ALTER TABLE usertable enable ROW LEVEL SECURITY;
ALTER TABLE usertable force ROW LEVEL SECURITY;
create function log_record(_tbl usertable) returns boolean language plpgsql
immutable as $$ begin raise info 'log: %', $1; return true; end; $$;
CREATE POLICY loggerPolicy ON usertable USING (log_record(usertable));

Now any update queries on this table fail. 

This was working correctly on 9.5.15.

Thanks to RhodiumToad from #postgresql  for verifying the bug.

Messages

DateAuthorSubject
2019-09-12 16:51:01+00PG Bug reporting formBUG #16006: Update queries fail on a table having any policy with a function that takes a whole-row var as arg
2019-09-12 20:33:55+00Tom LaneRe: BUG #16006: Update queries fail on a table having any policy with a function that takes a whole-row var as arg
2019-09-12 21:10:47+00Andres FreundRe: BUG #16006: Update queries fail on a table having any policy with a function that takes a whole-row var as arg
2019-09-12 22:28:25+00Tom LaneRe: BUG #16006: Update queries fail on a table having any policy with a function that takes a whole-row var as arg
2019-09-13 04:13:21+00Vinay BanakarRe: BUG #16006: Update queries fail on a table having any policy with a function that takes a whole-row var as arg
2019-09-13 04:29:17+00Tom LaneRe: BUG #16006: Update queries fail on a table having any policy with a function that takes a whole-row var as arg
2019-09-13 08:53:37+00Vinay BanakarRe: BUG #16006: Update queries fail on a table having any policy with a function that takes a whole-row var as arg
2019-09-13 11:59:24+00Tom LaneRe: BUG #16006: Update queries fail on a table having any policy with a function that takes a whole-row var as arg