SQL/JSON: Fix JSON_QUERY(... WITH CONDITIONAL WRAPPER)
Amit Langote <amitlan@postgresql.org>
SQL/JSON: Fix JSON_QUERY(... WITH CONDITIONAL WRAPPER) Currently, when WITH CONDITIONAL WRAPPER is specified, array wrappers are applied even to a single SQL/JSON item if it is a scalar JSON value, but this behavior does not comply with the standard. To fix, apply wrappers only when there are multiple SQL/JSON items in the result. Reported-by: Peter Eisentraut <peter@eisentraut.org> Author: Peter Eisentraut <peter@eisentraut.org> Author: Amit Langote <amitlangote09@gmail.com> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Discussion: https://postgr.es/m/8022e067-818b-45d3-8fab-6e0d94d03626%40eisentraut.org Backpatch-through: 17
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/jsonpath_exec.c | modified | +19 −5 |
| src/test/regress/expected/sqljson_queryfuncs.out | modified | +23 −26 |
| src/test/regress/sql/sqljson_queryfuncs.sql | modified | +6 −7 |
Discussion
- json_query conditional wrapper bug 13 messages · 2024-08-28 → 2024-09-12