mirror of
https://github.com/postgres/postgres.git
synced 2025-05-28 05:21:27 +03:00
Fix error message wording
The originals are ambiguous and a bit out of style. Reviewed-by: Amit Langote <amitlangote09@gmail.com> Discussion: https://postgr.es/m/202412141243.efesjyyvzxsz@alvherre.pgsql
This commit is contained in:
parent
e998901b88
commit
d7905aa1da
@ -4115,8 +4115,9 @@ transformJsonReturning(ParseState *pstate, JsonOutput *output, const char *fname
|
|||||||
if (returning->typid != JSONOID && returning->typid != JSONBOID)
|
if (returning->typid != JSONOID && returning->typid != JSONBOID)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||||
errmsg("cannot use RETURNING type %s in %s",
|
errmsg("cannot use type %s in RETURNING clause of %s",
|
||||||
format_type_be(returning->typid), fname),
|
format_type_be(returning->typid), fname),
|
||||||
|
errhint("Try returning json or jsonb."),
|
||||||
parser_errposition(pstate, output->typeName->location)));
|
parser_errposition(pstate, output->typeName->location)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4235,7 +4236,7 @@ transformJsonSerializeExpr(ParseState *pstate, JsonSerializeExpr *expr)
|
|||||||
if (typcategory != TYPCATEGORY_STRING)
|
if (typcategory != TYPCATEGORY_STRING)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||||
errmsg("cannot use RETURNING type %s in %s",
|
errmsg("cannot use type %s in RETURNING clause of %s",
|
||||||
format_type_be(returning->typid),
|
format_type_be(returning->typid),
|
||||||
"JSON_SERIALIZE()"),
|
"JSON_SERIALIZE()"),
|
||||||
errhint("Try returning a string type or bytea.")));
|
errhint("Try returning a string type or bytea.")));
|
||||||
|
@ -240,12 +240,12 @@ SQL error: null value without indicator on line 84
|
|||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ecpg_execute on line 99: using PQexec
|
[NO_PID]: ecpg_execute on line 99: using PQexec
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ecpg_check_PQresult on line 99: bad response - ERROR: cannot use RETURNING type jsonb in JSON_SERIALIZE()
|
[NO_PID]: ecpg_check_PQresult on line 99: bad response - ERROR: cannot use type jsonb in RETURNING clause of JSON_SERIALIZE()
|
||||||
HINT: Try returning a string type or bytea.
|
HINT: Try returning a string type or bytea.
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: raising sqlstate 42804 (sqlcode -400): cannot use RETURNING type jsonb in JSON_SERIALIZE() on line 99
|
[NO_PID]: raising sqlstate 42804 (sqlcode -400): cannot use type jsonb in RETURNING clause of JSON_SERIALIZE() on line 99
|
||||||
[NO_PID]: sqlca: code: -400, state: 42804
|
[NO_PID]: sqlca: code: -400, state: 42804
|
||||||
SQL error: cannot use RETURNING type jsonb in JSON_SERIALIZE() on line 99
|
SQL error: cannot use type jsonb in RETURNING clause of JSON_SERIALIZE() on line 99
|
||||||
[NO_PID]: ecpg_execute on line 102: query: with val ( js ) as ( values ( '{ "a": 1, "b": [{ "a": 1, "b": 0, "a": 2 }] }' ) ) select js is json "IS JSON" , js is not json "IS NOT JSON" , js is json value "IS VALUE" , js is json object "IS OBJECT" , js is json array "IS ARRAY" , js is json scalar "IS SCALAR" , js is json without unique keys "WITHOUT UNIQUE" , js is json with unique keys "WITH UNIQUE" from val; with 0 parameter(s) on connection ecpg1_regression
|
[NO_PID]: ecpg_execute on line 102: query: with val ( js ) as ( values ( '{ "a": 1, "b": [{ "a": 1, "b": 0, "a": 2 }] }' ) ) select js is json "IS JSON" , js is not json "IS NOT JSON" , js is json value "IS VALUE" , js is json object "IS OBJECT" , js is json array "IS ARRAY" , js is json scalar "IS SCALAR" , js is json without unique keys "WITHOUT UNIQUE" , js is json with unique keys "WITH UNIQUE" from val; with 0 parameter(s) on connection ecpg1_regression
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ecpg_execute on line 102: using PQexec
|
[NO_PID]: ecpg_execute on line 102: using PQexec
|
||||||
|
@ -272,7 +272,7 @@ SELECT pg_typeof(JSON_SERIALIZE(NULL));
|
|||||||
|
|
||||||
-- only string types or bytea allowed
|
-- only string types or bytea allowed
|
||||||
SELECT JSON_SERIALIZE('{ "a" : 1 } ' RETURNING jsonb);
|
SELECT JSON_SERIALIZE('{ "a" : 1 } ' RETURNING jsonb);
|
||||||
ERROR: cannot use RETURNING type jsonb in JSON_SERIALIZE()
|
ERROR: cannot use type jsonb in RETURNING clause of JSON_SERIALIZE()
|
||||||
HINT: Try returning a string type or bytea.
|
HINT: Try returning a string type or bytea.
|
||||||
EXPLAIN (VERBOSE, COSTS OFF) SELECT JSON_SERIALIZE('{}');
|
EXPLAIN (VERBOSE, COSTS OFF) SELECT JSON_SERIALIZE('{}');
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
|
Loading…
x
Reference in New Issue
Block a user