aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/regress/expected/insert.out41
-rw-r--r--src/test/regress/sql/insert.sql28
2 files changed, 69 insertions, 0 deletions
diff --git a/src/test/regress/expected/insert.out b/src/test/regress/expected/insert.out
index 1cf6531c019..14227d16a37 100644
--- a/src/test/regress/expected/insert.out
+++ b/src/test/regress/expected/insert.out
@@ -629,6 +629,47 @@ select tableoid::regclass, * from mlparted_def;
mlparted_defd | 70 | 100 |
(4 rows)
+-- Check multi-level tuple routing with attributes dropped from the
+-- top-most parent. First remove the last attribute.
+alter table mlparted add d int, add e int;
+alter table mlparted drop e;
+create table mlparted5 partition of mlparted
+ for values from (1, 40) to (1, 50) partition by range (c);
+create table mlparted5_ab partition of mlparted5
+ for values from ('a') to ('c') partition by list (c);
+create table mlparted5_a partition of mlparted5_ab for values in ('a');
+create table mlparted5_b (d int, b int, c text, a int);
+alter table mlparted5_ab attach partition mlparted5_b for values in ('b');
+truncate mlparted;
+insert into mlparted values (1, 2, 'a', 1);
+insert into mlparted values (1, 40, 'a', 1); -- goes to mlparted5_a
+insert into mlparted values (1, 45, 'b', 1); -- goes to mlparted5_b
+select tableoid::regclass, * from mlparted order by a, b, c, d;
+ tableoid | a | b | c | d
+-------------+---+----+---+---
+ mlparted11 | 1 | 2 | a | 1
+ mlparted5_a | 1 | 40 | a | 1
+ mlparted5_b | 1 | 45 | b | 1
+(3 rows)
+
+alter table mlparted drop d;
+truncate mlparted;
+-- Remove the before last attribute.
+alter table mlparted add e int, add d int;
+alter table mlparted drop e;
+insert into mlparted values (1, 2, 'a', 1);
+insert into mlparted values (1, 40, 'a', 1); -- goes to mlparted5_a
+insert into mlparted values (1, 45, 'b', 1); -- goes to mlparted5_b
+select tableoid::regclass, * from mlparted order by a, b, c, d;
+ tableoid | a | b | c | d
+-------------+---+----+---+---
+ mlparted11 | 1 | 2 | a | 1
+ mlparted5_a | 1 | 40 | a | 1
+ mlparted5_b | 1 | 45 | b | 1
+(3 rows)
+
+alter table mlparted drop d;
+drop table mlparted5;
-- check that message shown after failure to find a partition shows the
-- appropriate key description (or none) in various situations
create table key_desc (a int, b int) partition by list ((a+0));
diff --git a/src/test/regress/sql/insert.sql b/src/test/regress/sql/insert.sql
index a7f659bc2b4..4d1c92a54df 100644
--- a/src/test/regress/sql/insert.sql
+++ b/src/test/regress/sql/insert.sql
@@ -401,6 +401,34 @@ insert into mlparted values (70, 100);
select tableoid::regclass, * from mlparted_def;
+-- Check multi-level tuple routing with attributes dropped from the
+-- top-most parent. First remove the last attribute.
+alter table mlparted add d int, add e int;
+alter table mlparted drop e;
+create table mlparted5 partition of mlparted
+ for values from (1, 40) to (1, 50) partition by range (c);
+create table mlparted5_ab partition of mlparted5
+ for values from ('a') to ('c') partition by list (c);
+create table mlparted5_a partition of mlparted5_ab for values in ('a');
+create table mlparted5_b (d int, b int, c text, a int);
+alter table mlparted5_ab attach partition mlparted5_b for values in ('b');
+truncate mlparted;
+insert into mlparted values (1, 2, 'a', 1);
+insert into mlparted values (1, 40, 'a', 1); -- goes to mlparted5_a
+insert into mlparted values (1, 45, 'b', 1); -- goes to mlparted5_b
+select tableoid::regclass, * from mlparted order by a, b, c, d;
+alter table mlparted drop d;
+truncate mlparted;
+-- Remove the before last attribute.
+alter table mlparted add e int, add d int;
+alter table mlparted drop e;
+insert into mlparted values (1, 2, 'a', 1);
+insert into mlparted values (1, 40, 'a', 1); -- goes to mlparted5_a
+insert into mlparted values (1, 45, 'b', 1); -- goes to mlparted5_b
+select tableoid::regclass, * from mlparted order by a, b, c, d;
+alter table mlparted drop d;
+drop table mlparted5;
+
-- check that message shown after failure to find a partition shows the
-- appropriate key description (or none) in various situations
create table key_desc (a int, b int) partition by list ((a+0));