From 84c64d9e83ee582b4277c1e7c46590d5b7c54752 Mon Sep 17 00:00:00 2001 From: amit Date: Fri, 5 Apr 2019 11:32:40 +0900 Subject: [PATCH v2 1/2] Add tests for a fix for BUG #15733 --- src/test/regress/expected/insert.out | 21 +++++++++++++++++++++ src/test/regress/sql/insert.sql | 15 +++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/test/regress/expected/insert.out b/src/test/regress/expected/insert.out index 5edf269367..2752946e02 100644 --- a/src/test/regress/expected/insert.out +++ b/src/test/regress/expected/insert.out @@ -629,6 +629,27 @@ select tableoid::regclass, * from mlparted_def; mlparted_defd | 70 | 100 | (4 rows) +-- BUG #15733 +alter table mlparted add e int, add d 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 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); +ERROR: cannot extract attribute from empty tuple slot +insert into mlparted values (1, 45, 'b', 1); +ERROR: cannot extract attribute from empty tuple slot +select tableoid::regclass, * from mlparted order by a, b, c, d; + tableoid | a | b | c | d +------------+---+---+---+--- + mlparted11 | 1 | 2 | a | 1 +(1 row) + +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 a7f659bc2b..7cb4d31fe8 100644 --- a/src/test/regress/sql/insert.sql +++ b/src/test/regress/sql/insert.sql @@ -401,6 +401,21 @@ insert into mlparted values (70, 100); select tableoid::regclass, * from mlparted_def; +-- BUG #15733 +alter table mlparted add e int, add d 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 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