1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-18 02:02:55 +03:00

Refactor/reword some error messages to avoid duplicates

Also, remove brackets around "EMPTY [ ARRAY ]".  An error message is
not the place to state that a keyword is optional.

Backpatch to 17.
This commit is contained in:
Alvaro Herrera
2024-08-07 11:30:36 -04:00
parent 22b4a1b561
commit 2bb969f399
5 changed files with 74 additions and 34 deletions

View File

@@ -91,7 +91,7 @@ transformJsonTable(ParseState *pstate, JsonTable *jt)
jt->on_error->btype != JSON_BEHAVIOR_EMPTY_ARRAY)
ereport(ERROR,
errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid ON ERROR behavior"),
errmsg("invalid %s behavior", "ON ERROR"),
errdetail("Only EMPTY [ ARRAY ] or ERROR is allowed in the top-level ON ERROR clause."),
parser_errposition(pstate, jt->on_error->location));
@@ -292,7 +292,7 @@ transformJsonTableColumns(JsonTableParseContext *cxt, List *columns,
if (ordinality_found)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use more than one FOR ORDINALITY column"),
errmsg("only one FOR ORDINALITY column is allowed"),
parser_errposition(pstate, rawc->location)));
ordinality_found = true;
colexpr = NULL;