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

Commit 2ea90b3

Browse files
prohibit add_to_pathman_config() on partitions
1 parent 6d154fd commit 2ea90b3

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

‎expected/pathman_basic.out‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,18 @@ ORDER BY partition;
18511851

18521852
DROP TABLE test.provided_part_names CASCADE;
18531853
NOTICE: drop cascades to 2 other objects
1854+
/* Check that multilivel is prohibited */
1855+
CREATE TABLE test.multi(key int NOT NULL);
1856+
SELECT create_hash_partitions('test.multi', 'key', 3);
1857+
create_hash_partitions
1858+
------------------------
1859+
3
1860+
(1 row)
1861+
1862+
SELECT create_hash_partitions('test.multi_1', 'key', 3);
1863+
ERROR: multilevel partitioning is not supported
1864+
DROP TABLE test.multi CASCADE;
1865+
NOTICE: drop cascades to 3 other objects
18541866
DROP SCHEMA test CASCADE;
18551867
NOTICE: drop cascades to 28 other objects
18561868
DROP EXTENSION pg_pathman CASCADE;

‎sql/pathman_basic.sql‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,12 @@ ORDER BY partition;
551551

552552
DROP TABLE test.provided_part_names CASCADE;
553553

554+
/* Check that multilivel is prohibited */
555+
CREATE TABLE test.multi(key int NOT NULL);
556+
SELECT create_hash_partitions('test.multi', 'key', 3);
557+
SELECT create_hash_partitions('test.multi_1', 'key', 3);
558+
DROP TABLE test.multi CASCADE;
559+
554560

555561
DROP SCHEMA test CASCADE;
556562
DROP EXTENSION pg_pathman CASCADE;

‎src/pl_funcs.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
765765
Datum expr_datum;
766766

767767
PathmanInitState init_state;
768+
PartParentSearch parent_search;
768769

769770
if (!PG_ARGISNULL(0))
770771
{
@@ -798,6 +799,15 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
798799
get_rel_name_or_relid(relid))));
799800
}
800801

802+
/* Check if it's a partition */
803+
if (get_parent_of_partition(relid, &parent_search) &&
804+
parent_search == PPS_ENTRY_PART_PARENT)
805+
{
806+
ereport(ERROR,
807+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
808+
errmsg("multilevel partitioning is not supported")));
809+
}
810+
801811
/* Select partitioning type */
802812
switch (PG_NARGS())
803813
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /