summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/partition_prune.out29
-rw-r--r--src/test/regress/sql/partition_prune.sql15
2 files changed, 44 insertions, 0 deletions
diff --git a/src/test/regress/expected/partition_prune.out b/src/test/regress/expected/partition_prune.out
index c52bc40e812..f0707e7f7ea 100644
--- a/src/test/regress/expected/partition_prune.out
+++ b/src/test/regress/expected/partition_prune.out
@@ -1893,6 +1893,35 @@ explain (costs off) select * from rparted_by_int2 where a > 100_000_000_000_000;
(2 rows)
drop table lp, coll_pruning, rlp, mc3p, mc2p, boolpart, iboolpart, boolrangep, rp, coll_pruning_multi, like_op_noprune, lparted_by_int2, rparted_by_int2;
+-- check that AlternativeSubPlan within a pruning expression gets cleaned up
+create table asptab (id int primary key) partition by range (id);
+create table asptab0 partition of asptab for values from (0) to (1);
+create table asptab1 partition of asptab for values from (1) to (2);
+explain (costs off)
+select * from
+ (select exists (select 1 from int4_tbl tinner where f1 = touter.f1) as b
+ from int4_tbl touter) ss,
+ asptab
+where asptab.id > ss.b::int;
+ QUERY PLAN
+--------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on int4_tbl touter
+ -> Append
+ -> Index Only Scan using asptab0_pkey on asptab0 asptab_1
+ Index Cond: (id > (EXISTS(SubPlan 3))::integer)
+ SubPlan 4
+ -> Seq Scan on int4_tbl tinner_2
+ -> Index Only Scan using asptab1_pkey on asptab1 asptab_2
+ Index Cond: (id > (EXISTS(SubPlan 3))::integer)
+ SubPlan 3
+ -> Seq Scan on int4_tbl tinner_1
+ Filter: (f1 = touter.f1)
+ SubPlan 2
+ -> Seq Scan on int4_tbl tinner
+(14 rows)
+
+drop table asptab;
--
-- Test Partition pruning for HASH partitioning
--
diff --git a/src/test/regress/sql/partition_prune.sql b/src/test/regress/sql/partition_prune.sql
index d67598d5c7f..ea9a4fe4a23 100644
--- a/src/test/regress/sql/partition_prune.sql
+++ b/src/test/regress/sql/partition_prune.sql
@@ -388,6 +388,21 @@ explain (costs off) select * from rparted_by_int2 where a > 100_000_000_000_000;
drop table lp, coll_pruning, rlp, mc3p, mc2p, boolpart, iboolpart, boolrangep, rp, coll_pruning_multi, like_op_noprune, lparted_by_int2, rparted_by_int2;
+-- check that AlternativeSubPlan within a pruning expression gets cleaned up
+
+create table asptab (id int primary key) partition by range (id);
+create table asptab0 partition of asptab for values from (0) to (1);
+create table asptab1 partition of asptab for values from (1) to (2);
+
+explain (costs off)
+select * from
+ (select exists (select 1 from int4_tbl tinner where f1 = touter.f1) as b
+ from int4_tbl touter) ss,
+ asptab
+where asptab.id > ss.b::int;
+
+drop table asptab;
+
--
-- Test Partition pruning for HASH partitioning
--