Skip to content

Commit 84fa67f

Browse files
committed
Merge branch 'rel_1_3_beta' into rel_future_beta
2 parents b5059cd + 7813e85 commit 84fa67f

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

expected/pathman_basic.out

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,45 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.index_on_childs WHERE c1 > 100 AND c1 < 2
23922392
Filter: (c1 < 2500)
23932393
(12 rows)
23942394

2395+
/* Test recursive CTE */
2396+
CREATE TABLE test.recursive_cte_test_tbl(id INT NOT NULL, name TEXT NOT NULL);
2397+
SELECT * FROM create_hash_partitions('test.recursive_cte_test_tbl', 'id', 2);
2398+
create_hash_partitions
2399+
------------------------
2400+
2
2401+
(1 row)
2402+
2403+
INSERT INTO test.recursive_cte_test_tbl (id, name) SELECT id, 'name'||id FROM generate_series(1,100) f(id);
2404+
INSERT INTO test.recursive_cte_test_tbl (id, name) SELECT id, 'name'||(id + 1) FROM generate_series(1,100) f(id);
2405+
INSERT INTO test.recursive_cte_test_tbl (id, name) SELECT id, 'name'||(id + 2) FROM generate_series(1,100) f(id);
2406+
SELECT * FROM test.recursive_cte_test_tbl WHERE id = 5;
2407+
id | name
2408+
----+-------
2409+
5 | name5
2410+
5 | name6
2411+
5 | name7
2412+
(3 rows)
2413+
2414+
WITH RECURSIVE test AS (
2415+
SELECT min(name) AS name
2416+
FROM test.recursive_cte_test_tbl
2417+
WHERE id = 5
2418+
UNION ALL
2419+
SELECT (SELECT min(name)
2420+
FROM test.recursive_cte_test_tbl
2421+
WHERE id = 5 AND name > test.name)
2422+
FROM test
2423+
WHERE name IS NOT NULL)
2424+
SELECT * FROM test;
2425+
name
2426+
-------
2427+
name5
2428+
name6
2429+
name7
2430+
2431+
(4 rows)
2432+
23952433
DROP SCHEMA test CASCADE;
2396-
NOTICE: drop cascades to 51 other objects
2434+
NOTICE: drop cascades to 54 other objects
23972435
DROP EXTENSION pg_pathman CASCADE;
23982436
DROP SCHEMA pathman CASCADE;

sql/pathman_basic.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,27 @@ SELECT set_enable_parent('test.index_on_childs', true);
679679
VACUUM ANALYZE test.index_on_childs;
680680
EXPLAIN (COSTS OFF) SELECT * FROM test.index_on_childs WHERE c1 > 100 AND c1 < 2500 AND c2 = 500;
681681

682+
/* Test recursive CTE */
683+
CREATE TABLE test.recursive_cte_test_tbl(id INT NOT NULL, name TEXT NOT NULL);
684+
SELECT * FROM create_hash_partitions('test.recursive_cte_test_tbl', 'id', 2);
685+
INSERT INTO test.recursive_cte_test_tbl (id, name) SELECT id, 'name'||id FROM generate_series(1,100) f(id);
686+
INSERT INTO test.recursive_cte_test_tbl (id, name) SELECT id, 'name'||(id + 1) FROM generate_series(1,100) f(id);
687+
INSERT INTO test.recursive_cte_test_tbl (id, name) SELECT id, 'name'||(id + 2) FROM generate_series(1,100) f(id);
688+
SELECT * FROM test.recursive_cte_test_tbl WHERE id = 5;
689+
690+
WITH RECURSIVE test AS (
691+
SELECT min(name) AS name
692+
FROM test.recursive_cte_test_tbl
693+
WHERE id = 5
694+
UNION ALL
695+
SELECT (SELECT min(name)
696+
FROM test.recursive_cte_test_tbl
697+
WHERE id = 5 AND name > test.name)
698+
FROM test
699+
WHERE name IS NOT NULL)
700+
SELECT * FROM test;
701+
702+
682703
DROP SCHEMA test CASCADE;
683704
DROP EXTENSION pg_pathman CASCADE;
684705
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