From bdbb66d4363ba960674204ac7043bf826e97d5e8 Mon Sep 17 00:00:00 2001 From: amit Date: Fri, 5 Apr 2019 14:04:15 +0900 Subject: [PATCH v3] Add tests for a fix for BUG #15733 --- src/test/regress/expected/insert.out | 15 +++++++++++++++ src/test/regress/sql/insert.sql | 11 +++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/test/regress/expected/insert.out b/src/test/regress/expected/insert.out index d6c4394a75..17e6a73fc4 100644 --- a/src/test/regress/expected/insert.out +++ b/src/test/regress/expected/insert.out @@ -424,6 +424,21 @@ create trigger mlparted5abrtrig before insert on mlparted5a for each row execute 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). +-- Test that a tuple flows correctly through multiple levels of +-- partitioning where the parents of different levels have different +-- tuple layout. In this case, tuple conversion is needed between +-- mlparted (the root) and mlparted5, but not between mlparted5 and +-- mlparted5bc. (cf bug #1573) +create table mlparted5bc partition of mlparted5 for values in ('b', 'c') partition by list (c); +create table mlparted5b partition of mlparted5bc for values in ('b'); +truncate mlparted; +insert into mlparted values (1, 42, 'b'); +select * from mlparted5b; + c | a | b +---+---+---- + b | 1 | 42 +(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 diff --git a/src/test/regress/sql/insert.sql b/src/test/regress/sql/insert.sql index 4123d39c7b..7c1cad7f2a 100644 --- a/src/test/regress/sql/insert.sql +++ b/src/test/regress/sql/insert.sql @@ -273,6 +273,17 @@ insert into mlparted values (1, 45, 'a'); create function mlparted5abrtrig_func() returns trigger as $$ begin new.c = 'b'; return new; end; $$ language plpgsql; create trigger mlparted5abrtrig before insert on mlparted5a for each row execute procedure mlparted5abrtrig_func(); insert into mlparted5 (a, b, c) values (1, 40, 'a'); + +-- Test that a tuple flows correctly through multiple levels of +-- partitioning where the parents of different levels have different +-- tuple layout. In this case, tuple conversion is needed between +-- mlparted (the root) and mlparted5, but not between mlparted5 and +-- mlparted5bc. (cf bug #1573) +create table mlparted5bc partition of mlparted5 for values in ('b', 'c') partition by list (c); +create table mlparted5b partition of mlparted5bc for values in ('b'); +truncate mlparted; +insert into mlparted values (1, 42, 'b'); +select * from mlparted5b; drop table mlparted5; -- check that message shown after failure to find a partition shows the -- 2.11.0