Skip to content

Commit d2ff138

Browse files
committed
test arg relnames := ARRAY[...]::TEXT[] of create_hash_partitions()
1 parent 757e249 commit d2ff138

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

expected/pathman_basic.out

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,6 +2430,31 @@ SELECT * FROM test;
24302430

24312431
(4 rows)
24322432

2433+
/* Test create_range_partitions() + relnames */
2434+
CREATE TABLE test.provided_part_names(id INT NOT NULL);
2435+
INSERT INTO test.provided_part_names SELECT generate_series(1, 10);
2436+
SELECT create_hash_partitions('test.provided_part_names', 'id', 2,
2437+
relnames := ARRAY[]::TEXT[]); /* not ok */
2438+
ERROR: size of array 'relnames' must be equal to 'partitions_count'
2439+
SELECT create_hash_partitions('test.provided_part_names', 'id', 2,
2440+
relnames := ARRAY['p1', 'p2']::TEXT[]); /* ok */
2441+
create_hash_partitions
2442+
------------------------
2443+
2
2444+
(1 row)
2445+
2446+
/* list partitions */
2447+
SELECT partition FROM pathman_partition_list
2448+
WHERE parent = 'test.provided_part_names'::REGCLASS
2449+
ORDER BY partition;
2450+
partition
2451+
-----------
2452+
p1
2453+
p2
2454+
(2 rows)
2455+
2456+
DROP TABLE test.provided_part_names CASCADE;
2457+
NOTICE: drop cascades to 2 other objects
24332458
DROP SCHEMA test CASCADE;
24342459
NOTICE: drop cascades to 54 other objects
24352460
DROP EXTENSION pg_pathman CASCADE;

sql/pathman_basic.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,21 @@ WITH RECURSIVE test AS (
700700
SELECT * FROM test;
701701

702702

703+
/* Test create_range_partitions() + relnames */
704+
CREATE TABLE test.provided_part_names(id INT NOT NULL);
705+
INSERT INTO test.provided_part_names SELECT generate_series(1, 10);
706+
SELECT create_hash_partitions('test.provided_part_names', 'id', 2,
707+
relnames := ARRAY[]::TEXT[]); /* not ok */
708+
SELECT create_hash_partitions('test.provided_part_names', 'id', 2,
709+
relnames := ARRAY['p1', 'p2']::TEXT[]); /* ok */
710+
/* list partitions */
711+
SELECT partition FROM pathman_partition_list
712+
WHERE parent = 'test.provided_part_names'::REGCLASS
713+
ORDER BY partition;
714+
715+
DROP TABLE test.provided_part_names CASCADE;
716+
717+
703718
DROP SCHEMA test CASCADE;
704719
DROP EXTENSION pg_pathman CASCADE;
705720
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