Hi,On Mon, 25 May 2026 at 22:06, Srinath Reddy Sadipiralla <srinath2133@gmail.com> wrote:Hi,I have reviewed the patch , i think the error message might besomething likediff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.cindex 89d0f348303..59e34f082e4 100644--- a/src/backend/parser/parse_expr.c+++ b/src/backend/parser/parse_expr.c@@ -4203,6 +4203,13 @@ transformJsonParseArg(ParseState *pstate, Node *jsexpr, JsonFormat *format, TEXTOID, -1, COERCION_IMPLICIT, COERCE_IMPLICIT_CAST, -1);+ if(expr == NULL)+ ereport(ERROR,+ (errcode(ERRCODE_CANNOT_COERCE),+ errmsg("cannot cast type %s to %s",+ format_type_be(*exprtype),+ format_type_be(TEXTOID)),+ parser_errposition(pstate, exprLocation(raw_expr)))); *exprtype = TEXTOID; } Thanks, that reads better. v2 attached, raising ERRCODE_CANNOT_COERCEright where the coercion fails: ERROR: cannot cast type sqljson_mystr to textwhich also covers the JSON() WITH UNIQUE KEYS path.
Hi,I have reviewed the patch , i think the error message might besomething likediff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.cindex 89d0f348303..59e34f082e4 100644--- a/src/backend/parser/parse_expr.c+++ b/src/backend/parser/parse_expr.c@@ -4203,6 +4203,13 @@ transformJsonParseArg(ParseState *pstate, Node *jsexpr, JsonFormat *format, TEXTOID, -1, COERCION_IMPLICIT, COERCE_IMPLICIT_CAST, -1);+ if(expr == NULL)+ ereport(ERROR,+ (errcode(ERRCODE_CANNOT_COERCE),+ errmsg("cannot cast type %s to %s",+ format_type_be(*exprtype),+ format_type_be(TEXTOID)),+ parser_errposition(pstate, exprLocation(raw_expr)))); *exprtype = TEXTOID; }
pgsql-bugs by date:
Соглашаюсь с условиями обработки персональных данных