File tree 3 files changed +35
-3
lines changed
Filter options
3 files changed +35
-3
lines changed
Original file line number Diff line number Diff line change @@ -1804,7 +1804,25 @@ ORDER BY partition;
1804
1804
1805
1805
DROP TABLE test.provided_part_names CASCADE;
1806
1806
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"
1807
1825
DROP SCHEMA test CASCADE;
1808
- NOTICE: drop cascades to 28 other objects
1826
+ NOTICE: drop cascades to 32 other objects
1809
1827
DROP EXTENSION pg_pathman CASCADE;
1810
1828
DROP SCHEMA pathman CASCADE;
Original file line number Diff line number Diff line change @@ -546,6 +546,14 @@ ORDER BY partition;
546
546
547
547
DROP TABLE test .provided_part_names CASCADE;
548
548
549
+ /* test preventing of double expand of inherited tables */
550
+ CREATE TABLE test .mixinh_parent (id INT PRIMARY KEY );
551
+ CREATE TABLE test .mixinh_child1 () INHERITS (test .mixinh_parent );
552
+ SELECT create_range_partitions(' test.mixinh_child1' , ' id' , 1 , 10 , 1 );
553
+ INSERT INTO test .mixinh_child1 VALUES (1 );
554
+ SELECT * FROM test .mixinh_child1 ;
555
+ SELECT * FROM test .mixinh_parent ;
556
+
549
557
DROP SCHEMA test CASCADE;
550
558
DROP EXTENSION pg_pathman CASCADE;
551
559
DROP SCHEMA pathman CASCADE;
Original file line number Diff line number Diff line change @@ -406,10 +406,16 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
406
406
* and added its children to the plan.
407
407
*/
408
408
if (appinfo -> child_relid == rti &&
409
- child_oid == parent_oid &&
410
409
OidIsValid (appinfo -> parent_reloid ))
411
410
{
412
- goto cleanup ;
411
+ if (child_oid == parent_oid )
412
+ goto cleanup ;
413
+ else if (!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" )));
413
419
}
414
420
}
415
421
}
You can’t perform that action at this time.
0 commit comments