From b4fad46b6bc8a9bf46ff689bcb1bd4edf8f267af Mon Sep 17 00:00:00 2001 From: Amit Langote Date: Thu, 18 Apr 2024 14:33:47 +0900 Subject: SQL/JSON: Improve some error messages This improves some error messages emitted by SQL/JSON query functions by mentioning column name when available, such as when they are invoked as part of evaluating JSON_TABLE() columns. To do so, a new field column_name is added to both JsonFuncExpr and JsonExpr that is only populated when creating those nodes for transformed JSON_TABLE() columns. While at it, relevant error messages are reworded for clarity. Reported-by: Jian He Suggested-by: Jian He Discussion: https://postgr.es/m/CACJufxG_e0QLCgaELrr2ZNz7AxPeGCNKAORe3fHtFCQLsH4J4Q@mail.gmail.com --- src/backend/parser/parse_expr.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/backend/parser/parse_expr.c') diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 4c98d7a046c..34ac17868b5 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -4311,6 +4311,7 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func) jsexpr = makeNode(JsonExpr); jsexpr->location = func->location; jsexpr->op = func->op; + jsexpr->column_name = func->column_name; /* * jsonpath machinery can only handle jsonb documents, so coerce the input -- cgit v1.2.3