From 00605a8a27745dee7f5e77adf1cd714bc954d9b5 Mon Sep 17 00:00:00 2001 From: amit Date: Fri, 5 Apr 2019 11:32:40 +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 1cf6531c01..2cc58c7ba3 100644 --- a/src/test/regress/expected/insert.out +++ b/src/test/regress/expected/insert.out @@ -598,6 +598,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; alter table mlparted drop constraint check_b; -- Check multi-level default partition diff --git a/src/test/regress/sql/insert.sql b/src/test/regress/sql/insert.sql index a7f659bc2b..066268007b 100644 --- a/src/test/regress/sql/insert.sql +++ b/src/test/regress/sql/insert.sql @@ -381,6 +381,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; alter table mlparted drop constraint check_b; -- 2.11.0