From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | hyanchurevich(at)spotware(dot)com |
Subject: | BUG #17827: Rule on insert into table doesn't work when excepting select from the table itself |
Date: | 2023-03-09 10:27:00 |
Message-ID: | 17827-1dfd5ad9af280484@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 17827
Logged by: Hanna Yanchurevich
Email address: hyanchurevich(at)spotware(dot)com
PostgreSQL version: 13.2
Operating system: Centos 7
Description:
To reproduce this bug you may use following script:
create table tbl (id int);
create table rule_stat (msg text, id int);
create rule rule_tbl as on insert to tbl do insert into rule_stat
values('Rule triggered for ',new.id);
insert into tbl
select 1
except
select id from tbl;
table rule_stat; -- no rows
And using WHERE true clause for target table rule not working too:
insert into tbl
select 2
except
select id from tbl where true;
table rule_stat; -- no rows
But using WHERE false clause for target table rule starts working:
insert into tbl
select 1
except
select id from tbl where false;
table rule_stat; -- new row appears
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2023-03-09 10:42:21 | Re: BUG #17767: psql: tab-completion causes warnings when standard_conforming_strings = off |
Previous Message | PG Bug reporting form | 2023-03-09 09:10:58 | BUG #17826: An assert failed in /src/backend/optimizer/util/var.c |