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

Commitc48c2b2

Browse files
feodorarssher
authored andcommitted
PGPRO-3087 Prevent double expand partitioned table by built-in
inheritance and pg_pathman's one
1 parentc14d2ad commitc48c2b2

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

‎expected/pathman_basic.out

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,25 @@ ORDER BY partition;
18041804

18051805
DROP TABLE test.provided_part_names CASCADE;
18061806
NOTICE: drop cascades to 2 other objects
1807+
/* test preventing of double expand of inherited tables */
1808+
CREATE TABLE test.mixinh_parent (id INT PRIMARY KEY);
1809+
CREATE TABLE test.mixinh_child1 () INHERITS (test.mixinh_parent);
1810+
SELECT create_range_partitions('test.mixinh_child1', 'id', 1, 10, 1);
1811+
create_range_partitions
1812+
-------------------------
1813+
1
1814+
(1 row)
1815+
1816+
INSERT INTO test.mixinh_child1 VALUES (1);
1817+
SELECT * FROM test.mixinh_child1;
1818+
id
1819+
----
1820+
1
1821+
(1 row)
1822+
1823+
SELECT * FROM test.mixinh_parent;
1824+
ERROR: could not expand partitioned table "mixinh_child1"
18071825
DROP SCHEMA test CASCADE;
1808-
NOTICE: drop cascades to28 other objects
1826+
NOTICE: drop cascades to32 other objects
18091827
DROP EXTENSION pg_pathman CASCADE;
18101828
DROP SCHEMA pathman CASCADE;

‎sql/pathman_basic.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,14 @@ ORDER BY partition;
546546

547547
DROPTABLEtest.provided_part_names CASCADE;
548548

549+
/* test preventing of double expand of inherited tables*/
550+
CREATETABLEtest.mixinh_parent (idINTPRIMARY KEY);
551+
CREATETABLEtest.mixinh_child1 () INHERITS (test.mixinh_parent);
552+
SELECT create_range_partitions('test.mixinh_child1','id',1,10,1);
553+
INSERT INTOtest.mixinh_child1VALUES (1);
554+
SELECT*FROMtest.mixinh_child1;
555+
SELECT*FROMtest.mixinh_parent;
556+
549557
DROPSCHEMA test CASCADE;
550558
DROP EXTENSION pg_pathman CASCADE;
551559
DROPSCHEMA pathman CASCADE;

‎src/hooks.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,16 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
406406
* and added its children to the plan.
407407
*/
408408
if (appinfo->child_relid==rti&&
409-
child_oid==parent_oid&&
410409
OidIsValid(appinfo->parent_reloid))
411410
{
412-
gotocleanup;
411+
if (child_oid==parent_oid)
412+
gotocleanup;
413+
elseif (!has_pathman_relation_info(parent_oid))
414+
ereport(ERROR,
415+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
416+
errmsg("could not expand partitioned table \"%s\"",
417+
get_rel_name(child_oid)),
418+
errhint("Do not use inheritance and pg_pathman partitions together")));
413419
}
414420
}
415421
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp