mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Rearrange "add column" logic to merge columns at exec time.
The previous coding set attinhcount too high in some cases, resulting in
an undumpable, undroppable column. Per bug #5856, reported by Naoya
Anzai. See also commit 31b6fc06d8
, which
fixes a similar bug in ALTER TABLE .. ADD CONSTRAINT.
Patch by Noah Misch.
This commit is contained in:
@ -944,6 +944,18 @@ order by relname, attnum;
|
||||
|
||||
drop table p1, p2 cascade;
|
||||
|
||||
-- test attinhcount tracking with merged columns
|
||||
|
||||
create table depth0();
|
||||
create table depth1(c text) inherits (depth0);
|
||||
create table depth2() inherits (depth1);
|
||||
alter table depth0 add c text;
|
||||
|
||||
select attrelid::regclass, attname, attinhcount, attislocal
|
||||
from pg_attribute
|
||||
where attnum > 0 and attrelid::regclass in ('depth0', 'depth1', 'depth2')
|
||||
order by attrelid::regclass::text, attnum;
|
||||
|
||||
--
|
||||
-- Test the ALTER TABLE SET WITH/WITHOUT OIDS command
|
||||
--
|
||||
|
Reference in New Issue
Block a user