1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

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
This commit is contained in:
Amit Langote
2024-09-06 10:13:03 +09:00
parent 68222851d5
commit 565caaa79a
4 changed files with 33 additions and 3 deletions

View File

@ -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;