From 15c8ca8cd9581a1b8eac67bbccc50423803fd1e7 Mon Sep 17 00:00:00 2001 From: amit Date: Fri, 10 May 2019 13:52:41 +0900 Subject: [PATCH 1/2] Add test --- src/test/regress/expected/partition_prune.out | 17 +++++++++++++++++ src/test/regress/sql/partition_prune.sql | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/src/test/regress/expected/partition_prune.out b/src/test/regress/expected/partition_prune.out index 6f320dfff4..c8cd6a23f1 100644 --- a/src/test/regress/expected/partition_prune.out +++ b/src/test/regress/expected/partition_prune.out @@ -938,6 +938,23 @@ explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1) or (a = 10 a Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 9))) (9 rows) +-- +-- Check that pruning with composite range partitioning works correctly +-- correctly in the face of combination of static and runtime values being +-- passed to perform plan-time pruning with +-- +explain (costs off) select * from mc3p where a = 1 and abs(b) < (select 2); + QUERY PLAN +--------------------------------------------- + Append + InitPlan 1 (returns $0) + -> Result + -> Seq Scan on mc3p0 + Filter: ((a = 1) AND (abs(b) < $0)) + -> Seq Scan on mc3p_default + Filter: ((a = 1) AND (abs(b) < $0)) +(7 rows) + -- a simpler multi-column keys case create table mc2p (a int, b int) partition by range (a, b); create table mc2p_default partition of mc2p default; diff --git a/src/test/regress/sql/partition_prune.sql b/src/test/regress/sql/partition_prune.sql index eafbec6f35..adfdc4d3c0 100644 --- a/src/test/regress/sql/partition_prune.sql +++ b/src/test/regress/sql/partition_prune.sql @@ -122,6 +122,13 @@ explain (costs off) select * from mc3p where a = 1 or abs(b) = 1 or c = 1; explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1) or (a = 10 and abs(b) = 10); explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1) or (a = 10 and abs(b) = 9); +-- +-- Check that pruning with composite range partitioning works correctly +-- correctly in the face of combination of static and runtime values being +-- passed to perform plan-time pruning with +-- +explain (costs off) select * from mc3p where a = 1 and abs(b) < (select 2); + -- a simpler multi-column keys case create table mc2p (a int, b int) partition by range (a, b); create table mc2p_default partition of mc2p default; -- 2.11.0