From 10802a19e980c1cdfbb2b350a2a4d6eea0756719 Mon Sep 17 00:00:00 2001 From: amit Date: Fri, 5 Apr 2019 12:15:55 +0900 Subject: [PATCH] Add tests for a fix for BUG #15733 --- src/test/regress/expected/insert.out | 22 ++++++++++++++++++++++ src/test/regress/sql/insert.sql | 16 ++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/test/regress/expected/insert.out b/src/test/regress/expected/insert.out index d6c4394a75..2855f113d8 100644 --- a/src/test/regress/expected/insert.out +++ b/src/test/regress/expected/insert.out @@ -425,6 +425,28 @@ insert into mlparted5 (a, b, c) values (1, 40, 'a'); ERROR: new row for relation "mlparted5a" violates partition constraint DETAIL: Failing row contains (b, 1, 40). drop table mlparted5; +-- BUG #15733 +alter table mlparted add e int, add d int; +alter table mlparted drop e; +alter table mlparted drop constraint check_b; +create table mlparted5 partition of mlparted for values from (1, 40) to (1, 50) partition by range (c); +create table mlparted5ab partition of mlparted5 for values from ('a') to ('c') partition by list (c); +create table mlparted5a partition of mlparted5ab for values in ('a'); +create table mlparted5b (d int, b int, c text, a int); +alter table mlparted5ab attach partition mlparted5b for values in ('b'); +truncate mlparted; +insert into mlparted values (1, 2, 'a', 1); +insert into mlparted values (1, 40, 'a', 1); +insert into mlparted values (1, 45, 'b', 1); +select tableoid::regclass, * from mlparted order by a, b, c, d; + tableoid | a | b | c | d +------------+---+----+---+--- + mlparted11 | 1 | 2 | a | 1 + mlparted5a | 1 | 40 | a | 1 + mlparted5b | 1 | 45 | b | 1 +(3 rows) + +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 4123d39c7b..b8563a5073 100644 --- a/src/test/regress/sql/insert.sql +++ b/src/test/regress/sql/insert.sql @@ -275,6 +275,22 @@ create trigger mlparted5abrtrig before insert on mlparted5a for each row execute insert into mlparted5 (a, b, c) values (1, 40, 'a'); drop table mlparted5; +-- BUG #15733 +alter table mlparted add e int, add d int; +alter table mlparted drop e; +alter table mlparted drop constraint check_b; +create table mlparted5 partition of mlparted for values from (1, 40) to (1, 50) partition by range (c); +create table mlparted5ab partition of mlparted5 for values from ('a') to ('c') partition by list (c); +create table mlparted5a partition of mlparted5ab for values in ('a'); +create table mlparted5b (d int, b int, c text, a int); +alter table mlparted5ab attach partition mlparted5b for values in ('b'); +truncate mlparted; +insert into mlparted values (1, 2, 'a', 1); +insert into mlparted values (1, 40, 'a', 1); +insert into mlparted values (1, 45, 'b', 1); +select tableoid::regclass, * from mlparted order by a, b, c, 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)); -- 2.11.0