aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_expr.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2022-07-11 11:20:52 +0900
committerMichael Paquier <michael@paquier.xyz>2022-07-11 11:20:52 +0900
commit834fce52f941cd228beca2067dca82f6e33a4d98 (patch)
treeb814456a818a9c46710c922cdf09cd3a63769951 /src/backend/parser/parse_expr.c
parentb2b6c1be0569548893a80f15c74084243fb8d8a1 (diff)
downloadpostgresql-834fce52f941cd228beca2067dca82f6e33a4d98.tar.gz
postgresql-834fce52f941cd228beca2067dca82f6e33a4d98.zip
Improve error message with JSON_SERIALIZE()
The error message introduced in 3c633f3 can share the same format string with an existing message used for JSON(), reducing the translation effort. Author: Kyotaro Horiguchi Discussion: https://postgr.es/m/20220708.154135.2123613118233840495.horikyota.ntt@gmail.com Backpatch-through: 15
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 efcf1cd5abc..1dbdba93daa 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -4587,8 +4587,9 @@ transformJsonSerializeExpr(ParseState *pstate, JsonSerializeExpr *expr)
if (typcategory != TYPCATEGORY_STRING)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("cannot use RETURNING type %s in JSON_SERIALIZE",
- format_type_be(returning->typid)),
+ errmsg("cannot use RETURNING type %s in %s",
+ format_type_be(returning->typid),
+ "JSON_SERIALIZE()"),
errhint("Try returning a string type or bytea")));
}
}