@@ -1099,7 +1099,8 @@ transformAExprNullIf(ParseState *pstate, A_Expr *a)
1099
1099
if (result -> opresulttype != BOOLOID )
1100
1100
ereport (ERROR ,
1101
1101
(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" ),
1103
1104
parser_errposition (pstate , a -> location )));
1104
1105
if (result -> opretset )
1105
1106
ereport (ERROR ,
@@ -3060,7 +3061,9 @@ make_distinct_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree,
3060
3061
if (((OpExpr * ) result )-> opresulttype != BOOLOID )
3061
3062
ereport (ERROR ,
3062
3063
(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" ),
3064
3067
parser_errposition (pstate , location )));
3065
3068
if (((OpExpr * ) result )-> opretset )
3066
3069
ereport (ERROR ,
@@ -4326,15 +4329,22 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
4326
4329
if (func -> column_name == NULL )
4327
4330
ereport (ERROR ,
4328
4331
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()" ),
4331
4338
parser_errposition (pstate , func -> on_empty -> location ));
4332
4339
else
4333
4340
ereport (ERROR ,
4334
4341
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" ),
4338
4348
parser_errposition (pstate , func -> on_empty -> location ));
4339
4349
}
4340
4350
if (func -> on_error != NULL &&
@@ -4348,15 +4358,22 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
4348
4358
if (func -> column_name == NULL )
4349
4359
ereport (ERROR ,
4350
4360
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()" ),
4353
4367
parser_errposition (pstate , func -> on_error -> location ));
4354
4368
else
4355
4369
ereport (ERROR ,
4356
4370
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" ),
4360
4377
parser_errposition (pstate , func -> on_error -> location ));
4361
4378
}
4362
4379
}
@@ -4372,15 +4389,20 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
4372
4389
if (func -> column_name == NULL )
4373
4390
ereport (ERROR ,
4374
4391
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()" ),
4377
4396
parser_errposition (pstate , func -> on_error -> location ));
4378
4397
else
4379
4398
ereport (ERROR ,
4380
4399
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" ),
4384
4406
parser_errposition (pstate , func -> on_error -> location ));
4385
4407
}
4386
4408
if (func -> op == JSON_VALUE_OP )
@@ -4393,15 +4415,22 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
4393
4415
if (func -> column_name == NULL )
4394
4416
ereport (ERROR ,
4395
4417
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()" ),
4398
4424
parser_errposition (pstate , func -> on_empty -> location ));
4399
4425
else
4400
4426
ereport (ERROR ,
4401
4427
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" ),
4405
4434
parser_errposition (pstate , func -> on_empty -> location ));
4406
4435
}
4407
4436
if (func -> on_error != NULL &&
@@ -4412,15 +4441,22 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
4412
4441
if (func -> column_name == NULL )
4413
4442
ereport (ERROR ,
4414
4443
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()" ),
4417
4450
parser_errposition (pstate , func -> on_error -> location ));
4418
4451
else
4419
4452
ereport (ERROR ,
4420
4453
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" ),
4424
4460
parser_errposition (pstate , func -> on_error -> location ));
4425
4461
}
4426
4462
}
0 commit comments