summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/subselect.out23
-rw-r--r--src/test/regress/sql/subselect.sql5
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/regress/expected/subselect.out b/src/test/regress/expected/subselect.out
index 0fc93d9d726..21fbbb8e222 100644
--- a/src/test/regress/expected/subselect.out
+++ b/src/test/regress/expected/subselect.out
@@ -221,6 +221,29 @@ from int8_tbl group by q1 order by q1;
4567890123456789 | 0.6
(2 rows)
+-- check materialization of an initplan reference (bug #14524)
+explain (verbose, costs off)
+select 1 = all (select (select 1));
+ QUERY PLAN
+-----------------------------------
+ Result
+ Output: (SubPlan 2)
+ SubPlan 2
+ -> Materialize
+ Output: ($0)
+ InitPlan 1 (returns $0)
+ -> Result
+ Output: 1
+ -> Result
+ Output: $0
+(10 rows)
+
+select 1 = all (select (select 1));
+ ?column?
+----------
+ t
+(1 row)
+
--
-- Check EXISTS simplification with LIMIT
--
diff --git a/src/test/regress/sql/subselect.sql b/src/test/regress/sql/subselect.sql
index 29912230891..6e81ffe13f3 100644
--- a/src/test/regress/sql/subselect.sql
+++ b/src/test/regress/sql/subselect.sql
@@ -92,6 +92,11 @@ SELECT '' AS eight, ss.f1 AS "Correlated Field", ss.f3 AS "Second Field"
select q1, float8(count(*)) / (select count(*) from int8_tbl)
from int8_tbl group by q1 order by q1;
+-- check materialization of an initplan reference (bug #14524)
+explain (verbose, costs off)
+select 1 = all (select (select 1));
+select 1 = all (select (select 1));
+
--
-- Check EXISTS simplification with LIMIT
--