@@ -617,6 +617,56 @@ SELECT count(*) FROM pathman_config_params WHERE partrel = 'calamity.to_be_disab
617
617
0
618
618
(1 row)
619
619
620
+ /* check function get_part_range_by_idx() */
621
+ CREATE TABLE calamity.test_range_idx(val INT4 NOT NULL);
622
+ SELECT create_range_partitions('calamity.test_range_idx', 'val', 1, 10, 1);
623
+ NOTICE: sequence "test_range_idx_seq" does not exist, skipping
624
+ create_range_partitions
625
+ -------------------------
626
+ 1
627
+ (1 row)
628
+
629
+ SELECT get_part_range(NULL, 1, NULL::INT4); /* not ok */
630
+ ERROR: 'parent_relid' should not be NULL
631
+ SELECT get_part_range('calamity.test_range_idx', NULL, NULL::INT4); /* not ok */
632
+ ERROR: 'partition_idx' should not be NULL
633
+ SELECT get_part_range('calamity.test_range_idx', 0, NULL::INT2); /* not ok */
634
+ ERROR: pg_typeof(dummy) should be integer
635
+ SELECT get_part_range('calamity.test_range_idx', -2, NULL::INT4); /* not ok */
636
+ ERROR: negative indices other than -1 (last partition) are not allowed
637
+ SELECT get_part_range('calamity.test_range_idx', 4, NULL::INT4); /* not ok */
638
+ ERROR: partition #4 does not exist (total amount is 1)
639
+ SELECT get_part_range('calamity.test_range_idx', 0, NULL::INT4); /* OK */
640
+ get_part_range
641
+ ----------------
642
+ {1,11}
643
+ (1 row)
644
+
645
+ DROP TABLE calamity.test_range_idx CASCADE;
646
+ NOTICE: drop cascades to table calamity.test_range_idx_1
647
+ /* check function get_part_range_by_oid() */
648
+ CREATE TABLE calamity.test_range_oid(val INT4 NOT NULL);
649
+ SELECT create_range_partitions('calamity.test_range_oid', 'val', 1, 10, 1);
650
+ NOTICE: sequence "test_range_oid_seq" does not exist, skipping
651
+ create_range_partitions
652
+ -------------------------
653
+ 1
654
+ (1 row)
655
+
656
+ SELECT get_part_range(NULL, NULL::INT4); /* not ok */
657
+ ERROR: 'partition_relid' should not be NULL
658
+ SELECT get_part_range('pg_class', NULL::INT4); /* not ok */
659
+ ERROR: relation "pg_class" is not a partition
660
+ SELECT get_part_range('calamity.test_range_oid_1', NULL::INT2); /* not ok */
661
+ ERROR: pg_typeof(dummy) should be integer
662
+ SELECT get_part_range('calamity.test_range_oid_1', NULL::INT4); /* OK */
663
+ get_part_range
664
+ ----------------
665
+ {1,11}
666
+ (1 row)
667
+
668
+ DROP TABLE calamity.test_range_oid CASCADE;
669
+ NOTICE: drop cascades to table calamity.test_range_oid_1
620
670
DROP SCHEMA calamity CASCADE;
621
- NOTICE: drop cascades to 16 other objects
671
+ NOTICE: drop cascades to 18 other objects
622
672
DROP EXTENSION pg_pathman;
0 commit comments