could not find replacement targetlist entry for attno -6 - Mailing list pgsql-hackers

From jian he
Subject could not find replacement targetlist entry for attno -6
Date
Msg-id CACJufxGw5m8AzmkRnvsn5Eaw52ax6oD8THn1=hK2DQv5+FKUqw@mail.gmail.com
Whole thread Raw
Responses Re: could not find replacement targetlist entry for attno -6
List 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



--
jian
https://www.enterprisedb.com/



pgsql-hackers by date:

Previous
From: Ajit Awekar
Date:
Subject: Re: Periodic authorization expiration checks using GoAway message
Next
From: Chao Li
Date:
Subject: Re: tablecmds: fix bug where index rebuild loses replica identity on partitions