Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8899861

Browse files
committed
Merge remote-tracking branch 'origin/recursive_cte_test' into rel_1_3_beta
2 parentsdb3508e +0e54eef commit8899861

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 ANALYZEtest.index_on_childs;
661661
EXPLAIN (COSTS OFF)SELECT*FROMtest.index_on_childsWHERE c1>100AND c1<2500AND c2=500;
662662

663+
/* Test recursive CTE*/
664+
createtabletest.recursive_cte_test_tbl(idintnot null, nametextnot null);
665+
select*from create_hash_partitions('test.recursive_cte_test_tbl','id',2);
666+
insert intotest.recursive_cte_test_tbl (id, name)select id,'name'||idfrom generate_series(1,100) f(id);
667+
insert intotest.recursive_cte_test_tbl (id, name)select id,'name'||(id+1)from generate_series(1,100) f(id);
668+
insert intotest.recursive_cte_test_tbl (id, name)select id,'name'||(id+2)from generate_series(1,100) f(id);
669+
select*fromtest.recursive_cte_test_tblwhere id=5;
670+
with recursive testas (selectmin(name)as namefromtest.recursive_cte_test_tblwhere id=5union allselect (selectmin(name)fromtest.recursive_cte_test_tblwhere id=5and name>test.name)from testwhere nameis not null)select*from test;
671+
663672
DROPSCHEMA test CASCADE;
664673
DROP EXTENSION pg_pathman CASCADE;
665674
DROPSCHEMA pathman CASCADE;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp