aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_expr.c
diff options
context:
space:
mode:
authorAmit Langote <amitlan@postgresql.org>2024-09-06 10:13:03 +0900
committerAmit Langote <amitlan@postgresql.org>2024-09-06 12:01:49 +0900
commit5067c230b8ee42a01cc77dc5745bc3a78f393af3 (patch)
tree21bb2621cf5e39afc68a55a701f60059e409abc1 /src/backend/parser/parse_expr.c
parentc88ce386c4d7bfeb437ff31ec7c23c392c862e77 (diff)
downloadpostgresql-5067c230b8ee42a01cc77dc5745bc3a78f393af3.tar.gz
postgresql-5067c230b8ee42a01cc77dc5745bc3a78f393af3.zip
SQL/JSON: Fix default ON ERROR behavior for JSON_TABLE
Use EMPTY ARRAY instead of EMPTY. This change does not affect the runtime behavior of JSON_TABLE(), which continues to return an empty relation ON ERROR. It only alters whether the default ON ERROR behavior is shown in the deparsed output. Reported-by: Jian He <jian.universality@gmail.com> Discussion: https://postgr.es/m/CACJufxEo4sUjKCYtda0_qt9tazqqKPmF1cqhW9KBOUeJFqQd2g@mail.gmail.com Backpatch-through: 17
Diffstat (limited to 'src/backend/parser/parse_expr.c')
-rw-r--r--src/backend/parser/parse_expr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 56e413da9f5..36c1b7a88f2 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -4603,13 +4603,13 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
}
/*
- * Assume EMPTY ON ERROR when ON ERROR is not specified.
+ * Assume EMPTY ARRAY ON ERROR when ON ERROR is not specified.
*
* ON EMPTY cannot be specified at the top level but it can be for
* the individual columns.
*/
jsexpr->on_error = transformJsonBehavior(pstate, func->on_error,
- JSON_BEHAVIOR_EMPTY,
+ JSON_BEHAVIOR_EMPTY_ARRAY,
jsexpr->returning);
break;