Commit 387543f7 authored by Peter Eisentraut's avatar Peter Eisentraut

Make new error code name match SQL standard more closely

Discussion: https://www.postgresql.org/message-id/dff3d555-bea4-ac24-29b2-29521b9d08e8%402ndquadrant.com
parent bfbb1326
...@@ -344,7 +344,7 @@ returns bool ...@@ -344,7 +344,7 @@ returns bool
</itemizedlist> </itemizedlist>
Before doing so, the function should check the sign Before doing so, the function should check the sign
of <replaceable>offset</replaceable>: if it is less than zero, raise 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 with error text like <quote>invalid preceding or following size in window
function</quote>. (This is required by the SQL standard, although function</quote>. (This is required by the SQL standard, although
nonstandard operator families might perhaps choose to ignore this nonstandard operator families might perhaps choose to ignore this
......
...@@ -2056,7 +2056,7 @@ ExecWindowAgg(PlanState *pstate) ...@@ -2056,7 +2056,7 @@ ExecWindowAgg(PlanState *pstate)
if (offset < 0) if (offset < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("frame starting offset must not be negative"))); errmsg("frame starting offset must not be negative")));
} }
} }
...@@ -2081,7 +2081,7 @@ ExecWindowAgg(PlanState *pstate) ...@@ -2081,7 +2081,7 @@ ExecWindowAgg(PlanState *pstate)
if (offset < 0) if (offset < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("frame ending offset must not be negative"))); errmsg("frame ending offset must not be negative")));
} }
} }
......
...@@ -1889,7 +1889,7 @@ in_range_time_interval(PG_FUNCTION_ARGS) ...@@ -1889,7 +1889,7 @@ in_range_time_interval(PG_FUNCTION_ARGS)
*/ */
if (offset->time < 0) if (offset->time < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
/* /*
...@@ -2391,7 +2391,7 @@ in_range_timetz_interval(PG_FUNCTION_ARGS) ...@@ -2391,7 +2391,7 @@ in_range_timetz_interval(PG_FUNCTION_ARGS)
*/ */
if (offset->time < 0) if (offset->time < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
/* /*
......
...@@ -1198,7 +1198,7 @@ in_range_float8_float8(PG_FUNCTION_ARGS) ...@@ -1198,7 +1198,7 @@ in_range_float8_float8(PG_FUNCTION_ARGS)
*/ */
if (isnan(offset) || offset < 0) if (isnan(offset) || offset < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
/* /*
...@@ -1267,7 +1267,7 @@ in_range_float4_float8(PG_FUNCTION_ARGS) ...@@ -1267,7 +1267,7 @@ in_range_float4_float8(PG_FUNCTION_ARGS)
*/ */
if (isnan(offset) || offset < 0) if (isnan(offset) || offset < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
/* /*
......
...@@ -608,7 +608,7 @@ in_range_int4_int4(PG_FUNCTION_ARGS) ...@@ -608,7 +608,7 @@ in_range_int4_int4(PG_FUNCTION_ARGS)
if (offset < 0) if (offset < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
if (sub) if (sub)
...@@ -655,7 +655,7 @@ in_range_int4_int8(PG_FUNCTION_ARGS) ...@@ -655,7 +655,7 @@ in_range_int4_int8(PG_FUNCTION_ARGS)
if (offset < 0) if (offset < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
if (sub) if (sub)
...@@ -690,7 +690,7 @@ in_range_int2_int4(PG_FUNCTION_ARGS) ...@@ -690,7 +690,7 @@ in_range_int2_int4(PG_FUNCTION_ARGS)
if (offset < 0) if (offset < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
if (sub) if (sub)
......
...@@ -487,7 +487,7 @@ in_range_int8_int8(PG_FUNCTION_ARGS) ...@@ -487,7 +487,7 @@ in_range_int8_int8(PG_FUNCTION_ARGS)
if (offset < 0) if (offset < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
if (sub) if (sub)
......
...@@ -2185,7 +2185,7 @@ in_range_numeric_numeric(PG_FUNCTION_ARGS) ...@@ -2185,7 +2185,7 @@ in_range_numeric_numeric(PG_FUNCTION_ARGS)
*/ */
if (NUMERIC_IS_NAN(offset) || NUMERIC_SIGN(offset) == NUMERIC_NEG) if (NUMERIC_IS_NAN(offset) || NUMERIC_SIGN(offset) == NUMERIC_NEG)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
/* /*
......
...@@ -3280,7 +3280,7 @@ in_range_timestamptz_interval(PG_FUNCTION_ARGS) ...@@ -3280,7 +3280,7 @@ in_range_timestamptz_interval(PG_FUNCTION_ARGS)
if (int128_compare(interval_cmp_value(offset), int64_to_int128(0)) < 0) if (int128_compare(interval_cmp_value(offset), int64_to_int128(0)) < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
/* We don't currently bother to avoid overflow hazards here */ /* We don't currently bother to avoid overflow hazards here */
...@@ -3311,7 +3311,7 @@ in_range_timestamp_interval(PG_FUNCTION_ARGS) ...@@ -3311,7 +3311,7 @@ in_range_timestamp_interval(PG_FUNCTION_ARGS)
if (int128_compare(interval_cmp_value(offset), int64_to_int128(0)) < 0) if (int128_compare(interval_cmp_value(offset), int64_to_int128(0)) < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
/* We don't currently bother to avoid overflow hazards here */ /* We don't currently bother to avoid overflow hazards here */
...@@ -3342,7 +3342,7 @@ in_range_interval_interval(PG_FUNCTION_ARGS) ...@@ -3342,7 +3342,7 @@ in_range_interval_interval(PG_FUNCTION_ARGS)
if (int128_compare(interval_cmp_value(offset), int64_to_int128(0)) < 0) if (int128_compare(interval_cmp_value(offset), int64_to_int128(0)) < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PRECEDING_FOLLOWING_SIZE), (errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
errmsg("invalid preceding or following size in window function"))); errmsg("invalid preceding or following size in window function")));
/* We don't currently bother to avoid overflow hazards here */ /* We don't currently bother to avoid overflow hazards here */
......
...@@ -177,7 +177,7 @@ Section: Class 22 - Data Exception ...@@ -177,7 +177,7 @@ Section: Class 22 - Data Exception
22P06 E ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER nonstandard_use_of_escape_character 22P06 E ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER nonstandard_use_of_escape_character
22010 E ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE invalid_indicator_parameter_value 22010 E ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE invalid_indicator_parameter_value
22023 E ERRCODE_INVALID_PARAMETER_VALUE invalid_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 2201B E ERRCODE_INVALID_REGULAR_EXPRESSION invalid_regular_expression
2201W E ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE invalid_row_count_in_limit_clause 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 2201X E ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE invalid_row_count_in_result_offset_clause
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment