Skip to content

Commit 6ee0093

Browse files
committed
improve error message for case when default range interval is NULL
1 parent ba578fe commit 6ee0093

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

expected/pathman_interval.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SELECT set_interval('test_interval.abc', NULL::INT2);
1818

1919
/* pg_pathman shouldn't be able to create a new partition */
2020
INSERT INTO test_interval.abc VALUES (250);
21-
ERROR: cannot find appropriate partition for key '250'
21+
ERROR: cannot spawn new partition for key '250'
2222
/* Set a trivial interval */
2323
SELECT set_interval('test_interval.abc', 0);
2424
ERROR: interval should not be trivial
@@ -61,7 +61,7 @@ SELECT set_interval('test_interval.abc', NULL::INT4);
6161

6262
/* pg_pathman shouldn't be able to create a new partition */
6363
INSERT INTO test_interval.abc VALUES (250);
64-
ERROR: cannot find appropriate partition for key '250'
64+
ERROR: cannot spawn new partition for key '250'
6565
/* Set a trivial interval */
6666
SELECT set_interval('test_interval.abc', 0);
6767
ERROR: interval should not be trivial
@@ -104,7 +104,7 @@ SELECT set_interval('test_interval.abc', NULL::INT8);
104104

105105
/* pg_pathman shouldn't be able to create a new partition */
106106
INSERT INTO test_interval.abc VALUES (250);
107-
ERROR: cannot find appropriate partition for key '250'
107+
ERROR: cannot spawn new partition for key '250'
108108
/* Set a trivial interval */
109109
SELECT set_interval('test_interval.abc', 0);
110110
ERROR: interval should not be trivial

src/partition_creation.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,11 @@ create_partitions_for_value_internal(Oid relid, Datum value, Oid value_type,
408408
/* Check if interval is set */
409409
if (isnull[Anum_pathman_config_range_interval - 1])
410410
{
411-
elog(ERROR,
412-
"cannot find appropriate partition for key '%s'",
413-
datum_to_cstring(value, value_type));
411+
ereport(ERROR,
412+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
413+
errmsg("cannot spawn new partition for key '%s'",
414+
datum_to_cstring(value, value_type)),
415+
errdetail("default range interval is NULL")));
414416
}
415417

416418
/* Retrieve interval as TEXT from tuple */

0 commit comments

Comments
 (0)