@@ -1099,7 +1099,8 @@ transformAExprNullIf(ParseState *pstate, A_Expr *a)
10991099 if (result -> opresulttype != BOOLOID )
11001100 ereport (ERROR ,
11011101 (errcode (ERRCODE_DATATYPE_MISMATCH ),
1102- errmsg ("NULLIF requires = operator to yield boolean" ),
1102+ /* translator: %s is name of a SQL construct, eg NULLIF */
1103+ errmsg ("%s requires = operator to yield boolean" , "NULLIF" ),
11031104 parser_errposition (pstate , a -> location )));
11041105 if (result -> opretset )
11051106 ereport (ERROR ,
@@ -3060,7 +3061,9 @@ make_distinct_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree,
30603061 if (((OpExpr * ) result )-> opresulttype != BOOLOID )
30613062 ereport (ERROR ,
30623063 (errcode (ERRCODE_DATATYPE_MISMATCH ),
3063- errmsg ("IS DISTINCT FROM requires = operator to yield boolean" ),
3064+ /* translator: %s is name of a SQL construct, eg NULLIF */
3065+ errmsg ("%s requires = operator to yield boolean" ,
3066+ "IS DISTINCT FROM" ),
30643067 parser_errposition (pstate , location )));
30653068 if (((OpExpr * ) result )-> opretset )
30663069 ereport (ERROR ,
@@ -4326,15 +4329,22 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
43264329 if (func -> column_name == NULL )
43274330 ereport (ERROR ,
43284331 errcode (ERRCODE_SYNTAX_ERROR ),
4329- errmsg ("invalid ON EMPTY behavior" ),
4330- errdetail ("Only ERROR, NULL, EMPTY [ ARRAY ], EMPTY OBJECT, or DEFAULT expression is allowed in ON EMPTY for JSON_QUERY()." ),
4332+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4333+ errmsg ("invalid %s behavior" , "ON EMPTY" ),
4334+ /*- translator: first %s is name of a SQL/JSON clause (eg. ON EMPTY),
4335+ second %s is a SQL/JSON function name (e.g. JSON_QUERY) */
4336+ errdetail ("Only ERROR, NULL, EMPTY ARRAY, EMPTY OBJECT, or DEFAULT expression is allowed in %s for %s." ,
4337+ "ON EMPTY" , "JSON_QUERY()" ),
43314338 parser_errposition (pstate , func -> on_empty -> location ));
43324339 else
43334340 ereport (ERROR ,
43344341 errcode (ERRCODE_SYNTAX_ERROR ),
4335- errmsg ("invalid ON EMPTY behavior for column \"%s\"" ,
4336- func -> column_name ),
4337- errdetail ("Only ERROR, NULL, EMPTY [ ARRAY ], EMPTY OBJECT, or DEFAULT expression is allowed in ON EMPTY for formatted columns." ),
4342+ /*- translator: first %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4343+ errmsg ("invalid %s behavior for column \"%s\"" ,
4344+ "ON EMPTY" , func -> column_name ),
4345+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4346+ errdetail ("Only ERROR, NULL, EMPTY ARRAY, EMPTY OBJECT, or DEFAULT expression is allowed in %s for formatted columns." ,
4347+ "ON EMPTY" ),
43384348 parser_errposition (pstate , func -> on_empty -> location ));
43394349 }
43404350 if (func -> on_error != NULL &&
@@ -4348,15 +4358,22 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
43484358 if (func -> column_name == NULL )
43494359 ereport (ERROR ,
43504360 errcode (ERRCODE_SYNTAX_ERROR ),
4351- errmsg ("invalid ON ERROR behavior" ),
4352- errdetail ("Only ERROR, NULL, EMPTY [ ARRAY ], EMPTY OBJECT, or DEFAULT expression is allowed in ON ERROR for JSON_QUERY()." ),
4361+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4362+ errmsg ("invalid %s behavior" , "ON ERROR" ),
4363+ /*- translator: first %s is name of a SQL/JSON clause (eg. ON EMPTY),
4364+ second %s is a SQL/JSON function name (e.g. JSON_QUERY) */
4365+ errdetail ("Only ERROR, NULL, EMPTY ARRAY, EMPTY OBJECT, or DEFAULT expression is allowed in %s for %s." ,
4366+ "ON ERROR" , "JSON_QUERY()" ),
43534367 parser_errposition (pstate , func -> on_error -> location ));
43544368 else
43554369 ereport (ERROR ,
43564370 errcode (ERRCODE_SYNTAX_ERROR ),
4357- errmsg ("invalid ON ERROR behavior for column \"%s\"" ,
4358- func -> column_name ),
4359- errdetail ("Only ERROR, NULL, EMPTY [ ARRAY ], EMPTY OBJECT, or DEFAULT expression is allowed in ON ERROR for formatted columns." ),
4371+ /*- translator: first %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4372+ errmsg ("invalid %s behavior for column \"%s\"" ,
4373+ "ON ERROR" , func -> column_name ),
4374+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4375+ errdetail ("Only ERROR, NULL, EMPTY ARRAY, EMPTY OBJECT, or DEFAULT expression is allowed in %s for formatted columns." ,
4376+ "ON ERROR" ),
43604377 parser_errposition (pstate , func -> on_error -> location ));
43614378 }
43624379 }
@@ -4372,15 +4389,20 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
43724389 if (func -> column_name == NULL )
43734390 ereport (ERROR ,
43744391 errcode (ERRCODE_SYNTAX_ERROR ),
4375- errmsg ("invalid ON ERROR behavior" ),
4376- errdetail ("Only ERROR, TRUE, FALSE, or UNKNOWN is allowed in ON ERROR for JSON_EXISTS()." ),
4392+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4393+ errmsg ("invalid %s behavior" , "ON ERROR" ),
4394+ errdetail ("Only ERROR, TRUE, FALSE, or UNKNOWN is allowed in %s for %s." ,
4395+ "ON ERROR" , "JSON_EXISTS()" ),
43774396 parser_errposition (pstate , func -> on_error -> location ));
43784397 else
43794398 ereport (ERROR ,
43804399 errcode (ERRCODE_SYNTAX_ERROR ),
4381- errmsg ("invalid ON ERROR behavior for column \"%s\"" ,
4382- func -> column_name ),
4383- errdetail ("Only ERROR, TRUE, FALSE, or UNKNOWN is allowed in ON ERROR for EXISTS columns." ),
4400+ /*- translator: first %s is name a SQL/JSON clause (eg. ON EMPTY) */
4401+ errmsg ("invalid %s behavior for column \"%s\"" ,
4402+ "ON ERROR" , func -> column_name ),
4403+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4404+ errdetail ("Only ERROR, TRUE, FALSE, or UNKNOWN is allowed in %s for EXISTS columns." ,
4405+ "ON ERROR" ),
43844406 parser_errposition (pstate , func -> on_error -> location ));
43854407 }
43864408 if (func -> op == JSON_VALUE_OP )
@@ -4393,15 +4415,22 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
43934415 if (func -> column_name == NULL )
43944416 ereport (ERROR ,
43954417 errcode (ERRCODE_SYNTAX_ERROR ),
4396- errmsg ("invalid ON EMPTY behavior" ),
4397- errdetail ("Only ERROR, NULL, or DEFAULT expression is allowed in ON EMPTY for JSON_VALUE()." ),
4418+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4419+ errmsg ("invalid %s behavior" , "ON EMPTY" ),
4420+ /*- translator: first %s is name of a SQL/JSON clause (eg. ON EMPTY),
4421+ second %s is a SQL/JSON function name (e.g. JSON_QUERY) */
4422+ errdetail ("Only ERROR, NULL, or DEFAULT expression is allowed in %s for %s." ,
4423+ "ON EMPTY" , "JSON_VALUE()" ),
43984424 parser_errposition (pstate , func -> on_empty -> location ));
43994425 else
44004426 ereport (ERROR ,
44014427 errcode (ERRCODE_SYNTAX_ERROR ),
4402- errmsg ("invalid ON EMPTY behavior for column \"%s\"" ,
4403- func -> column_name ),
4404- errdetail ("Only ERROR, NULL, or DEFAULT expression is allowed in ON EMPTY for scalar columns." ),
4428+ /*- translator: first %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4429+ errmsg ("invalid %s behavior for column \"%s\"" ,
4430+ "ON EMPTY" , func -> column_name ),
4431+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4432+ errdetail ("Only ERROR, NULL, or DEFAULT expression is allowed in %s for scalar columns." ,
4433+ "ON EMPTY" ),
44054434 parser_errposition (pstate , func -> on_empty -> location ));
44064435 }
44074436 if (func -> on_error != NULL &&
@@ -4412,15 +4441,22 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
44124441 if (func -> column_name == NULL )
44134442 ereport (ERROR ,
44144443 errcode (ERRCODE_SYNTAX_ERROR ),
4415- errmsg ("invalid ON ERROR behavior" ),
4416- errdetail ("Only ERROR, NULL, or DEFAULT expression is allowed in ON ERROR for JSON_VALUE()." ),
4444+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4445+ errmsg ("invalid %s behavior" , "ON ERROR" ),
4446+ /*- translator: first %s is name of a SQL/JSON clause (eg. ON EMPTY),
4447+ second %s is a SQL/JSON function name (e.g. JSON_QUERY) */
4448+ errdetail ("Only ERROR, NULL, or DEFAULT expression is allowed in %s for %s." ,
4449+ "ON ERROR" , "JSON_VALUE()" ),
44174450 parser_errposition (pstate , func -> on_error -> location ));
44184451 else
44194452 ereport (ERROR ,
44204453 errcode (ERRCODE_SYNTAX_ERROR ),
4421- errmsg ("invalid ON ERROR behavior for column \"%s\"" ,
4422- func -> column_name ),
4423- errdetail ("Only ERROR, NULL, or DEFAULT expression is allowed in ON ERROR for scalar columns." ),
4454+ /*- translator: first %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4455+ errmsg ("invalid %s behavior for column \"%s\"" ,
4456+ "ON ERROR" , func -> column_name ),
4457+ /*- translator: %s is name of a SQL/JSON clause (eg. ON EMPTY) */
4458+ errdetail ("Only ERROR, NULL, or DEFAULT expression is allowed in %s for scalar columns." ,
4459+ "ON ERROR" ),
44244460 parser_errposition (pstate , func -> on_error -> location ));
44254461 }
44264462 }
0 commit comments