diff options
Diffstat (limited to 'src/test/regress/sql/with.sql')
-rw-r--r-- | src/test/regress/sql/with.sql | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/regress/sql/with.sql b/src/test/regress/sql/with.sql index 8f6e6c0b405..bcf0242fa40 100644 --- a/src/test/regress/sql/with.sql +++ b/src/test/regress/sql/with.sql @@ -347,6 +347,18 @@ UNION ALL SELECT t1.id, t2.path, t2 FROM t AS t1 JOIN t AS t2 ON (t1.id=t2.id); +CREATE TEMP TABLE duplicates (a INT NOT NULL); +INSERT INTO duplicates VALUES(1), (1); + +-- Try out a recursive UNION case where the non-recursive part's table slot +-- uses TTSOpsBufferHeapTuple and contains duplicate rows. +WITH RECURSIVE cte (a) as ( + SELECT a FROM duplicates + UNION + SELECT a FROM cte +) +SELECT a FROM cte; + -- test that column statistics from a materialized CTE are available -- to upper planner (otherwise, we'd get a stupider plan) explain (costs off) |