1
0
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:
Robert Haas
2011-04-03 21:52:47 -04:00
parent cabf5d84b6
commit 6c57239985
4 changed files with 119 additions and 73 deletions

View File

@ -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
--