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

Commitd2ff138

Browse files
committed
test arg relnames := ARRAY[...]::TEXT[] of create_hash_partitions()
1 parent757e249 commitd2ff138

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+
CREATETABLEtest.provided_part_names(idINTNOT NULL);
705+
INSERT INTOtest.provided_part_namesSELECT 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 partitionFROM pathman_partition_list
712+
WHERE parent='test.provided_part_names'::REGCLASS
713+
ORDER BY partition;
714+
715+
DROPTABLEtest.provided_part_names CASCADE;
716+
717+
703718
DROPSCHEMA test CASCADE;
704719
DROP EXTENSION pg_pathman CASCADE;
705720
DROPSCHEMA pathman CASCADE;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp