| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | could not find replacement targetlist entry for attno -6 |
| Date: | 2026-01-27 08:27:03 |
| Message-ID: | CACJufxGw5m8AzmkRnvsn5Eaw52ax6oD8THn1=hK2DQv5+FKUqw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi.
While reviewing ON CONFLICT DO SELECT, I found an elog(ERROR) behavior, which
may a bug. It is also unclear whether ``INSERT tableoid::regclass`` is
expected to
return "hat_data" or "hats". The following test case is copied from
src/test/regress/sql/rules.sql
----------
DROP TABLE IF EXISTS hats, hat_data;
CREATE TABLE hats (hat_name char(10) primary key, hat_color char(10));
CREATE TABLE hat_data (hat_name char(10), hat_color char(10));
CREATE UNIQUE INDEX hat_data_unique_idx on hat_data (hat_name COLLATE
"C" bpchar_pattern_ops);
CREATE RULE hat_upsert AS ON INSERT TO hats
DO INSTEAD
INSERT INTO hat_data VALUES (
NEW.hat_name,
NEW.hat_color)
ON CONFLICT (hat_name)
DO UPDATE
SET hat_name = hat_data.hat_name, hat_color = excluded.hat_color
WHERE excluded.hat_color <> 'forbidden' AND hat_data.* != excluded.*
RETURNING *;
INSERT INTO hats VALUES ('h8', 'black') RETURNING *, tableoid::regclass;
ERROR: could not find replacement targetlist entry for attno -6
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-01-27 08:30:10 | Re: tablecmds: fix bug where index rebuild loses replica identity on partitions |
| Previous Message | Ajit Awekar | 2026-01-27 08:19:34 | Re: Periodic authorization expiration checks using GoAway message |