]> granicus.if.org Git - postgresql/blobdiff - src/test/regress/sql/alter_table.sql
Fix inherited UPDATE for cases where child column numbering doesn't
[postgresql] / src / test / regress / sql / alter_table.sql
index 4d20705f53a5a4b8bfdf46a55c3ba19d57d138a2..79ea952adeefb2f15e1e52181756abaa6a0ca9f9 100644 (file)
@@ -849,3 +849,21 @@ where relname in ('p1','p2','c1','gc1') and attnum > 0 and not attisdropped
 order by relname, attnum;
 
 drop table p1, p2 cascade;
+
+-- test renumbering of child-table columns in inherited operations
+
+create table p1 (f1 int);
+create table c1 (f2 text, f3 int) inherits (p1);
+
+alter table p1 add column a1 int check (a1 > 0);
+alter table p1 add column f2 text;
+
+insert into p1 values (1,2,'abc');
+insert into c1 values(11,'xyz',33,0); -- should fail
+insert into c1 values(11,'xyz',33,22);
+
+select * from p1;
+update p1 set a1 = a1 + 1, f2 = upper(f2);
+select * from p1;
+
+drop table p1 cascade;