summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2019-05-06 12:44:24 +0000
committerMichael Paquier2019-05-06 12:44:24 +0000
commit91248608a61d5504f8ac46534136de9b3717fed2 (patch)
treeb92a57276ca2daa108f4389986d1048f8169d82f
parenta0905056fd6b0927dd33f185adc9e7503515fc0d (diff)
Add tests for error message generation in partition tuple routing
This adds extra tests for the error message generated for partition tuple routing in the executor, using more than three levels of partitioning including partitioned tables with no partitions. These tests have been added to fix CVE-2019-10129 on REL_11_STABLE. HEAD has no active bugs in this area, but it lacked coverage. Author: Michael Paquier Reviewed-by: Noah Misch Security: CVE-2019-10129
-rw-r--r--src/test/regress/expected/insert.out15
-rw-r--r--src/test/regress/sql/insert.sql7
2 files changed, 22 insertions, 0 deletions
diff --git a/src/test/regress/expected/insert.out b/src/test/regress/expected/insert.out
index 14227d16a37..75e25cdf484 100644
--- a/src/test/regress/expected/insert.out
+++ b/src/test/regress/expected/insert.out
@@ -637,6 +637,9 @@ 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);
+-- This partitioned table should remain with no partitions.
+create table mlparted5_cd partition of mlparted5
+ for values from ('c') to ('e') 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');
@@ -644,6 +647,12 @@ 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
+insert into mlparted values (1, 45, 'c', 1); -- goes to mlparted5_cd, fails
+ERROR: no partition of relation "mlparted5_cd" found for row
+DETAIL: Partition key of the failing row contains (c) = (c).
+insert into mlparted values (1, 45, 'f', 1); -- goes to mlparted5, fails
+ERROR: no partition of relation "mlparted5" found for row
+DETAIL: Partition key of the failing row contains (c) = (f).
select tableoid::regclass, * from mlparted order by a, b, c, d;
tableoid | a | b | c | d
-------------+---+----+---+---
@@ -660,6 +669,12 @@ 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
+insert into mlparted values (1, 45, 'c', 1); -- goes to mlparted5_cd, fails
+ERROR: no partition of relation "mlparted5_cd" found for row
+DETAIL: Partition key of the failing row contains (c) = (c).
+insert into mlparted values (1, 45, 'f', 1); -- goes to mlparted5, fails
+ERROR: no partition of relation "mlparted5" found for row
+DETAIL: Partition key of the failing row contains (c) = (f).
select tableoid::regclass, * from mlparted order by a, b, c, d;
tableoid | a | b | c | d
-------------+---+----+---+---
diff --git a/src/test/regress/sql/insert.sql b/src/test/regress/sql/insert.sql
index 4d1c92a54df..23885f638c0 100644
--- a/src/test/regress/sql/insert.sql
+++ b/src/test/regress/sql/insert.sql
@@ -409,6 +409,9 @@ 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);
+-- This partitioned table should remain with no partitions.
+create table mlparted5_cd partition of mlparted5
+ for values from ('c') to ('e') 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');
@@ -416,6 +419,8 @@ 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
+insert into mlparted values (1, 45, 'c', 1); -- goes to mlparted5_cd, fails
+insert into mlparted values (1, 45, 'f', 1); -- goes to mlparted5, fails
select tableoid::regclass, * from mlparted order by a, b, c, d;
alter table mlparted drop d;
truncate mlparted;
@@ -425,6 +430,8 @@ 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
+insert into mlparted values (1, 45, 'c', 1); -- goes to mlparted5_cd, fails
+insert into mlparted values (1, 45, 'f', 1); -- goes to mlparted5, fails
select tableoid::regclass, * from mlparted order by a, b, c, d;
alter table mlparted drop d;
drop table mlparted5;