mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Prevent display of dropped columns in row constraint violation messages.
ExecBuildSlotValueDescription() printed "null" for each dropped column in a row being complained of by ExecConstraints(). This has some sanity in terms of the underlying implementation, but is of course pretty surprising to users. To fix, we must pass the target relation's descriptor to ExecBuildSlotValueDescription(), because the slot descriptor it had been using doesn't get labeled with attisdropped markers. Per bug #8408 from Maxim Boguk. Back-patch to 9.2 where the feature of printing row values in NOT NULL and CHECK constraint violation messages was introduced. Michael Paquier and Tom Lane
This commit is contained in:
@ -874,6 +874,15 @@ select * from atacc1;
|
||||
|
||||
drop table atacc1;
|
||||
|
||||
-- test constraint error reporting in presence of dropped columns
|
||||
create table atacc1 (id serial primary key, value int check (value < 10));
|
||||
insert into atacc1(value) values (100);
|
||||
alter table atacc1 drop column value;
|
||||
alter table atacc1 add column value int check (value < 10);
|
||||
insert into atacc1(value) values (100);
|
||||
insert into atacc1(id, value) values (null, 0);
|
||||
drop table atacc1;
|
||||
|
||||
-- test inheritance
|
||||
create table parent (a int, b int, c int);
|
||||
insert into parent values (1, 2, 3);
|
||||
|
Reference in New Issue
Block a user