From 387543f7bdf0f1ca3dc06e6bb5c9ef7980cf9f44 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 11 Jun 2018 11:15:28 -0400 Subject: [PATCH] Make new error code name match SQL standard more closely Discussion: https://www.postgresql.org/message-id/dff3d555-bea4-ac24-29b2-29521b9d08e8%402ndquadrant.com --- doc/src/sgml/btree.sgml | 2 +- src/backend/executor/nodeWindowAgg.c | 4 ++-- src/backend/utils/adt/date.c | 4 ++-- src/backend/utils/adt/float.c | 4 ++-- src/backend/utils/adt/int.c | 6 +++--- src/backend/utils/adt/int8.c | 2 +- src/backend/utils/adt/numeric.c | 2 +- src/backend/utils/adt/timestamp.c | 6 +++--- src/backend/utils/errcodes.txt | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/src/sgml/btree.sgml b/doc/src/sgml/btree.sgml index ca81fbbc84..336d026ea1 100644 --- a/doc/src/sgml/btree.sgml +++ b/doc/src/sgml/btree.sgml @@ -344,7 +344,7 @@ returns bool Before doing so, the function should check the sign of offset: if it is less than zero, raise - error ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE (22013) + error ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE (22013) with error text like invalid preceding or following size in window function. (This is required by the SQL standard, although nonstandard operator families might perhaps choose to ignore this diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c index fe5369a0c7..968d5d3771 100644 --- a/src/backend/executor/nodeWindowAgg.c +++ b/src/backend/executor/nodeWindowAgg.c @@ -2056,7 +2056,7 @@ ExecWindowAgg(PlanState *pstate) if (offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("frame starting offset must not be negative"))); } } @@ -2081,7 +2081,7 @@ ExecWindowAgg(PlanState *pstate) if (offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("frame ending offset must not be negative"))); } } diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index eea2904414..87146a2161 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -1889,7 +1889,7 @@ in_range_time_interval(PG_FUNCTION_ARGS) */ if (offset->time < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); /* @@ -2391,7 +2391,7 @@ in_range_timetz_interval(PG_FUNCTION_ARGS) */ if (offset->time < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); /* diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index d32c1c141f..b86205b098 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -1198,7 +1198,7 @@ in_range_float8_float8(PG_FUNCTION_ARGS) */ if (isnan(offset) || offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); /* @@ -1267,7 +1267,7 @@ in_range_float4_float8(PG_FUNCTION_ARGS) */ if (isnan(offset) || offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); /* diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c index 559c365fec..02783d8d6f 100644 --- a/src/backend/utils/adt/int.c +++ b/src/backend/utils/adt/int.c @@ -608,7 +608,7 @@ in_range_int4_int4(PG_FUNCTION_ARGS) if (offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); if (sub) @@ -655,7 +655,7 @@ in_range_int4_int8(PG_FUNCTION_ARGS) if (offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); if (sub) @@ -690,7 +690,7 @@ in_range_int2_int4(PG_FUNCTION_ARGS) if (offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); if (sub) diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c index e6bae6860d..96686ccb2c 100644 --- a/src/backend/utils/adt/int8.c +++ b/src/backend/utils/adt/int8.c @@ -487,7 +487,7 @@ in_range_int8_int8(PG_FUNCTION_ARGS) if (offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); if (sub) diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 8dfdffcfbd..074294cbcc 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -2185,7 +2185,7 @@ in_range_numeric_numeric(PG_FUNCTION_ARGS) */ if (NUMERIC_IS_NAN(offset) || NUMERIC_SIGN(offset) == NUMERIC_NEG) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); /* diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 265b1db7f6..1d75caebe1 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -3280,7 +3280,7 @@ in_range_timestamptz_interval(PG_FUNCTION_ARGS) if (int128_compare(interval_cmp_value(offset), int64_to_int128(0)) < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); /* We don't currently bother to avoid overflow hazards here */ @@ -3311,7 +3311,7 @@ in_range_timestamp_interval(PG_FUNCTION_ARGS) if (int128_compare(interval_cmp_value(offset), int64_to_int128(0)) < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); /* We don't currently bother to avoid overflow hazards here */ @@ -3342,7 +3342,7 @@ in_range_interval_interval(PG_FUNCTION_ARGS) if (int128_compare(interval_cmp_value(offset), int64_to_int128(0)) < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), + (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE), errmsg("invalid preceding or following size in window function"))); /* We don't currently bother to avoid overflow hazards here */ diff --git a/src/backend/utils/errcodes.txt b/src/backend/utils/errcodes.txt index 9871d1e793..e2976600e8 100644 --- a/src/backend/utils/errcodes.txt +++ b/src/backend/utils/errcodes.txt @@ -177,7 +177,7 @@ Section: Class 22 - Data Exception 22P06 E ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER nonstandard_use_of_escape_character 22010 E ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE invalid_indicator_parameter_value 22023 E ERRCODE_INVALID_PARAMETER_VALUE invalid_parameter_value -22013 E ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE invalid_preceding_following_size +22013 E ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE invalid_preceding_or_following_size 2201B E ERRCODE_INVALID_REGULAR_EXPRESSION invalid_regular_expression 2201W E ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE invalid_row_count_in_limit_clause 2201X E ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE invalid_row_count_in_result_offset_clause -- 2.40.0