Fix remaining problems in 'triggers' test case.
authorPavan Deolasee <pavan.deolasee@gmail.com>
Wed, 26 Jul 2017 06:17:28 +0000 (11:47 +0530)
committerPavan Deolasee <pavan.deolasee@gmail.com>
Wed, 26 Jul 2017 06:17:28 +0000 (11:47 +0530)
We don't support different column ordering for partitions in XL. So enforce
that either by ensuring consistent column ordering or accepting errors. Also we
don't support triggers in XL, so some changes were necessary to take that into
account.

src/test/regress/expected/triggers.out
src/test/regress/sql/triggers.sql

index 45f33d768c54b72f6ab0e26bd6004f189790fbbb..e4682d72a59eca2e57e3c5dd5f617a213447f2f3 100644 (file)
@@ -1756,11 +1756,13 @@ create table parent (a text, b int) partition by list (a);
 -- a child matching parent
 create table child1 partition of parent for values in ('AAA');
 -- a child with a dropped column
-create table child2 (x int, a text, b int);
+create table child2 (a text, b int, x int);
 alter table child2 drop column x;
 alter table parent attach partition child2 for values in ('BBB');
 -- a child with a different column order
-create table child3 (b int, a text);
+-- XXX XL does not support child with different column order, so change that,
+-- though it probably defeats the purpose of the test
+create table child3 (a text, b int);
 alter table parent attach partition child3 for values in ('CCC');
 create trigger parent_insert_trig
   after insert on parent referencing new table as new_table
@@ -1825,7 +1827,7 @@ DETAIL:  The feature is not currently supported
 -- insert directly into children sees respective child-format tuples
 insert into child1 values ('AAA', 42);
 insert into child2 values ('BBB', 42);
-insert into child3 values (42, 'CCC');
+insert into child3 (b, a) values (42, 'CCC');
 -- update via parent sees parent-format tuples
 update parent set b = b + 1;
 -- delete via parent sees parent-format tuples
@@ -1904,11 +1906,14 @@ create trigger child_row_trig
 ERROR:  Postgres-XL does not support TRIGGER yet
 DETAIL:  The feature is not currently supported
 -- but now we're not allowed to reattach it
+-- XXX This does not fail in XL because trigger creation itself fails
 alter table parent attach partition child for values in ('AAA');
 -- drop the trigger, and now we're allowed to attach it again
 drop trigger child_row_trig on child;
 ERROR:  trigger "child_row_trig" for table "child" does not exist
+-- XXX and this fails because the previous attach worked ok
 alter table parent attach partition child for values in ('AAA');
+ERROR:  "child" is already a partition
 drop table child, parent;
 --
 -- Verify behavior of statement triggers on (non-partition)
@@ -1921,8 +1926,12 @@ create table parent (a text, b int);
 -- a child matching parent
 create table child1 () inherits (parent);
 -- a child with a different column order
+-- XXX this fails in XL because we don't allow different column ordering
 create table child2 (b int, a text);
 alter table child2 inherit parent;
+ERROR:  table "child2" contains column "a" at position 2, but parent "parent" has it at position 1
+DETAIL:  Postgres-XL requires attribute positions to match
+HINT:  Check for column ordering and dropped columns, if any
 -- a child with an extra column
 create table child3 (c text) inherits (parent);
 create trigger parent_insert_trig
index f5cb9ded70814f700cfe81b5aefc7906e6551df5..8e1df401498051adf30761150e9cea9de996d5d7 100644 (file)
@@ -1419,12 +1419,14 @@ create table parent (a text, b int) partition by list (a);
 create table child1 partition of parent for values in ('AAA');
 
 -- a child with a dropped column
-create table child2 (x int, a text, b int);
+create table child2 (a text, b int, x int);
 alter table child2 drop column x;
 alter table parent attach partition child2 for values in ('BBB');
 
 -- a child with a different column order
-create table child3 (b int, a text);
+-- XXX XL does not support child with different column order, so change that,
+-- though it probably defeats the purpose of the test
+create table child3 (a text, b int);
 alter table parent attach partition child3 for values in ('CCC');
 
 create trigger parent_insert_trig
@@ -1470,7 +1472,7 @@ create trigger child3_delete_trig
 -- insert directly into children sees respective child-format tuples
 insert into child1 values ('AAA', 42);
 insert into child2 values ('BBB', 42);
-insert into child3 values (42, 'CCC');
+insert into child3 (b, a) values (42, 'CCC');
 
 -- update via parent sees parent-format tuples
 update parent set b = b + 1;
@@ -1564,10 +1566,13 @@ create trigger child_row_trig
   for each row execute procedure dump_insert();
 
 -- but now we're not allowed to reattach it
+-- XXX This does not fail in XL because trigger creation itself fails
 alter table parent attach partition child for values in ('AAA');
 
 -- drop the trigger, and now we're allowed to attach it again
 drop trigger child_row_trig on child;
+
+-- XXX and this fails because the previous attach worked ok
 alter table parent attach partition child for values in ('AAA');
 
 drop table child, parent;
@@ -1586,6 +1591,7 @@ create table parent (a text, b int);
 create table child1 () inherits (parent);
 
 -- a child with a different column order
+-- XXX this fails in XL because we don't allow different column ordering
 create table child2 (b int, a text);
 alter table child2 inherit parent;