@@ -270,19 +270,21 @@ SELECT build_range_condition('calamity.part_test', 'val', NULL, 10); /* OK */
270270(1 row)
271271
272272/* check function validate_interval_value() */
273- SELECT validate_interval_value(1::REGCLASS, 'expr', 2, '1 mon', 'cooked_expr'); /* not ok */
273+ SELECT validate_interval_value(1::REGCLASS, 'expr', 2, '1 mon', 'cooked_expr'); /* not ok */
274274ERROR: relation "1" does not exist
275- SELECT validate_interval_value(NULL, 'expr', 2, '1 mon', 'cooked_expr'); /* not ok */
275+ SELECT validate_interval_value(NULL, 'expr', 2, '1 mon', 'cooked_expr'); /* not ok */
276276ERROR: 'partrel' should not be NULL
277- SELECT validate_interval_value('pg_class', NULL, 2, '1 mon', 'cooked_expr'); /* not ok */
277+ SELECT validate_interval_value('pg_class', NULL, 2, '1 mon', 'cooked_expr'); /* not ok */
278278ERROR: 'expression' should not be NULL
279- SELECT validate_interval_value('pg_class', 'oid', 1, 'HASH', NULL); /* not ok */
279+ SELECT validate_interval_value('pg_class', 'oid', NULL, '1 mon', 'cooked_expr'); /* not ok */
280+ ERROR: 'parttype' should not be NULL
281+ SELECT validate_interval_value('pg_class', 'oid', 1, 'HASH', NULL); /* not ok */
280282ERROR: interval should be NULL for HASH partitioned table
281- SELECT validate_interval_value('pg_class', 'expr', 2, '1 mon', NULL); /* not ok */
283+ SELECT validate_interval_value('pg_class', 'expr', 2, '1 mon', NULL); /* not ok */
282284ERROR: cannot find type name for attribute "expr" of relation "pg_class"
283- SELECT validate_interval_value('pg_class', 'expr', 2, NULL, 'cooked_expr'); /* not ok */
285+ SELECT validate_interval_value('pg_class', 'expr', 2, NULL, 'cooked_expr'); /* not ok */
284286ERROR: unrecognized token: "cooked_expr"
285- SELECT validate_interval_value('pg_class', 'EXPR', 1, 'HASH', NULL); /* not ok */
287+ SELECT validate_interval_value('pg_class', 'EXPR', 1, 'HASH', NULL); /* not ok */
286288ERROR: cannot find type name for attribute "expr" of relation "pg_class"
287289/* check function validate_relname() */
288290SELECT validate_relname('calamity.part_test');
@@ -749,8 +751,46 @@ SELECT get_part_range('calamity.test_range_oid_1', NULL::INT4); /* OK */
749751
750752DROP TABLE calamity.test_range_oid CASCADE;
751753NOTICE: drop cascades to table calamity.test_range_oid_1
754+ /* check function merge_range_partitions() */
755+ SELECT merge_range_partitions('{pg_class}'); /* not ok */
756+ ERROR: cannot merge partitions
757+ \errverbose
758+ ERROR: XX000: cannot merge partitions
759+ DETAIL: there must be at least two partitions
760+ LOCATION: merge_range_partitions, pl_range_funcs.c:625
761+ SELECT merge_range_partitions('{pg_class, pg_inherits}'); /* not ok */
762+ ERROR: cannot merge partitions
763+ \errverbose
764+ ERROR: XX000: cannot merge partitions
765+ DETAIL: relation "pg_class" is not a partition
766+ LOCATION: merge_range_partitions, pl_range_funcs.c:636
767+ CREATE TABLE calamity.merge_test_a(val INT4 NOT NULL);
768+ CREATE TABLE calamity.merge_test_b(val INT4 NOT NULL);
769+ SELECT create_range_partitions('calamity.merge_test_a', 'val', 1, 10, 2);
770+ NOTICE: sequence "merge_test_a_seq" does not exist, skipping
771+ create_range_partitions
772+ -------------------------
773+ 2
774+ (1 row)
775+
776+ SELECT create_range_partitions('calamity.merge_test_b', 'val', 1, 10, 2);
777+ NOTICE: sequence "merge_test_b_seq" does not exist, skipping
778+ create_range_partitions
779+ -------------------------
780+ 2
781+ (1 row)
782+
783+ SELECT merge_range_partitions('{calamity.merge_test_a_1,
784+ calamity.merge_test_b_1}'); /* not ok */
785+ ERROR: cannot merge partitions
786+ \errverbose
787+ ERROR: XX000: cannot merge partitions
788+ DETAIL: all relations must share the same parent
789+ LOCATION: merge_range_partitions, pl_range_funcs.c:645
790+ DROP TABLE calamity.merge_test_a,calamity.merge_test_b CASCADE;
791+ NOTICE: drop cascades to 4 other objects
752792DROP SCHEMA calamity CASCADE;
753- NOTICE: drop cascades to 18 other objects
793+ NOTICE: drop cascades to 20 other objects
754794DROP EXTENSION pg_pathman;
755795/*
756796 * -------------------------------------
0 commit comments