aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_expr.c
diff options
context:
space:
mode:
authorÁlvaro Herrera <alvherre@alvh.no-ip.org>2025-01-07 20:07:32 +0100
committerÁlvaro Herrera <alvherre@alvh.no-ip.org>2025-01-07 20:07:32 +0100
commit0e5b14410e2bb54d191bbb7bb21a674ccabe768e (patch)
tree67f66da1e79946cf9491ad3ff3c6ec14da330421 /src/backend/parser/parse_expr.c
parentc4782c44101ef9e50daa9e1d69821d98f58057fd (diff)
downloadpostgresql-0e5b14410e2bb54d191bbb7bb21a674ccabe768e.tar.gz
postgresql-0e5b14410e2bb54d191bbb7bb21a674ccabe768e.zip
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
Diffstat (limited to 'src/backend/parser/parse_expr.c')
-rw-r--r--src/backend/parser/parse_expr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 84d214f5c74..d1f64f8f0a5 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -4113,8 +4113,9 @@ transformJsonReturning(ParseState *pstate, JsonOutput *output, const char *fname
if (returning->typid != JSONOID && returning->typid != JSONBOID)
ereport(ERROR,
(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),
+ errhint("Try returning json or jsonb."),
parser_errposition(pstate, output->typeName->location)));
}
else
@@ -4233,7 +4234,7 @@ transformJsonSerializeExpr(ParseState *pstate, JsonSerializeExpr *expr)
if (typcategory != TYPCATEGORY_STRING)
ereport(ERROR,
(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),
"JSON_SERIALIZE()"),
errhint("Try returning a string type or bytea.")));