diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/with.out | 15 | ||||
-rw-r--r-- | src/test/regress/sql/with.sql | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/regress/expected/with.out b/src/test/regress/expected/with.out index 2c3e36f5fe1..1226fbc9f4a 100644 --- a/src/test/regress/expected/with.out +++ b/src/test/regress/expected/with.out @@ -627,6 +627,21 @@ SELECT t1.id, t2.path, t2 FROM t AS t1 JOIN t AS t2 ON 16 | {3,7,11,16} | (16,"{3,7,11,16}") (16 rows) +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; + a +--- + 1 +(1 row) + -- -- test cycle detection -- diff --git a/src/test/regress/sql/with.sql b/src/test/regress/sql/with.sql index c2d1555fb08..bae20e0d841 100644 --- a/src/test/regress/sql/with.sql +++ b/src/test/regress/sql/with.sql @@ -339,6 +339,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 cycle detection -- |