Make new error code name match SQL standard more closely

Discussion: https://www.postgresql.org/message-id/dff3d555-bea4-ac24-29b2-29521b9d08e8%402ndquadrant.com
This commit is contained in:
Peter Eisentraut 2018-06-11 11:15:28 -04:00
parent bfbb13264a
commit 387543f7bd
9 changed files with 16 additions and 16 deletions

View File

@ -344,7 +344,7 @@ returns bool
</itemizedlist>
Before doing so, the function should check the sign
of <replaceable>offset</replaceable>: if it is less than zero, raise
error <literal>ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE</literal> (22013)
error <literal>ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE</literal> (22013)
with error text like <quote>invalid preceding or following size in window
function</quote>. (This is required by the SQL standard, although
nonstandard operator families might perhaps choose to ignore this

View File

@ -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")));
}
}

View File

@ -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")));
/*

View File

@ -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")));
/*

View File

@ -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)

View File

@ -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)

View File

@ -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")));
/*

View File

@ -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 */

View File

@ -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