Skip to content

Commit 8899861

Browse files
committed
Merge remote-tracking branch 'origin/recursive_cte_test' into rel_1_3_beta
2 parents db3508e + 0e54eef commit 8899861

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

expected/pathman_basic.out

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,6 +2309,34 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.index_on_childs WHERE c1 > 100 AND c1 < 2
23092309
Filter: (c1 < 2500)
23102310
(12 rows)
23112311

2312+
/* Test recursive CTE */
2313+
create table test.recursive_cte_test_tbl(id int not null, name text not null);
2314+
select * from create_hash_partitions('test.recursive_cte_test_tbl', 'id', 2);
2315+
create_hash_partitions
2316+
------------------------
2317+
2
2318+
(1 row)
2319+
2320+
insert into test.recursive_cte_test_tbl (id, name) select id, 'name'||id from generate_series(1,100) f(id);
2321+
insert into test.recursive_cte_test_tbl (id, name) select id, 'name'||(id + 1) from generate_series(1,100) f(id);
2322+
insert into test.recursive_cte_test_tbl (id, name) select id, 'name'||(id + 2) from generate_series(1,100) f(id);
2323+
select * from test.recursive_cte_test_tbl where id = 5;
2324+
id | name
2325+
----+-------
2326+
5 | name5
2327+
5 | name6
2328+
5 | name7
2329+
(3 rows)
2330+
2331+
with recursive test as (select min(name) as name from test.recursive_cte_test_tbl where id = 5 union all select (select min(name) from test.recursive_cte_test_tbl where id = 5 and name > test.name) from test where name is not null) select * from test;
2332+
name
2333+
-------
2334+
name5
2335+
name6
2336+
name7
2337+
2338+
(4 rows)
2339+
23122340
DROP SCHEMA test CASCADE;
23132341
NOTICE: drop cascades to 51 other objects
23142342
DROP EXTENSION pg_pathman CASCADE;

sql/pathman_basic.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,15 @@ SELECT set_enable_parent('test.index_on_childs', true);
660660
VACUUM ANALYZE test.index_on_childs;
661661
EXPLAIN (COSTS OFF) SELECT * FROM test.index_on_childs WHERE c1 > 100 AND c1 < 2500 AND c2 = 500;
662662

663+
/* Test recursive CTE */
664+
create table test.recursive_cte_test_tbl(id int not null, name text not null);
665+
select * from create_hash_partitions('test.recursive_cte_test_tbl', 'id', 2);
666+
insert into test.recursive_cte_test_tbl (id, name) select id, 'name'||id from generate_series(1,100) f(id);
667+
insert into test.recursive_cte_test_tbl (id, name) select id, 'name'||(id + 1) from generate_series(1,100) f(id);
668+
insert into test.recursive_cte_test_tbl (id, name) select id, 'name'||(id + 2) from generate_series(1,100) f(id);
669+
select * from test.recursive_cte_test_tbl where id = 5;
670+
with recursive test as (select min(name) as name from test.recursive_cte_test_tbl where id = 5 union all select (select min(name) from test.recursive_cte_test_tbl where id = 5 and name > test.name) from test where name is not null) select * from test;
671+
663672
DROP SCHEMA test CASCADE;
664673
DROP EXTENSION pg_pathman CASCADE;
665674
DROP SCHEMA pathman CASCADE;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy