From 899f39ea25f2ee63a0c557f3908e15b280a4367a Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 7 Aug 2024 11:30:36 -0400 Subject: 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. --- src/backend/executor/execExprInterp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/backend/executor') diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index 1633ea83731..c32ac7c5098 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -4634,13 +4634,17 @@ ExecEvalJsonCoercionFinish(ExprState *state, ExprEvalStep *op) if (DatumGetBool(jsestate->error.value)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("could not coerce ON ERROR expression (%s) to the RETURNING type", + /*- translator: first %s is a SQL/JSON clause (e.g. ON ERROR) */ + errmsg("could not coerce %s expression (%s) to the RETURNING type", + "ON ERROR", GetJsonBehaviorValueString(jsestate->jsexpr->on_error)), errdetail("%s", jsestate->escontext.error_data->message))); else if (DatumGetBool(jsestate->empty.value)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("could not coerce ON EMPTY expression (%s) to the RETURNING type", + /*- translator: first %s is a SQL/JSON clause (e.g. ON ERROR) */ + errmsg("could not coerce %s expression (%s) to the RETURNING type", + "ON EMPTY", GetJsonBehaviorValueString(jsestate->jsexpr->on_empty)), errdetail("%s", jsestate->escontext.error_data->message))); -- cgit v1.2.3