pgsql: Fix JsonExpr deparsing to emit QUOTES and WRAPPER correctly

Started by Amit Langoteabout 2 years ago1 messagescomitters
Jump to latest
#1Amit Langote
Langote_Amit_f8@lab.ntt.co.jp

Fix JsonExpr deparsing to emit QUOTES and WRAPPER correctly

Currently, get_json_expr_options() does not emit the default values
for QUOTES (KEEP QUOTES) and WRAPPER (WITHOUT WRAPPER). That causes
the deparsed JSON_TABLE() columns, such as those contained in a a
view's query, to behave differently when executed than the original
definition. That's because the rules encoded in
transformJsonTableColumns() will choose either JSON_VALUE() or
JSON_QUERY() as implementation to execute a given column's path
expression depending on the QUOTES and WRAPPER specificationd and
they have slightly different semantics.

Reported-by: Jian He <jian.universality@gmail.com>
Discussion: /messages/by-id/CACJufxEqhqsfrg_p7EMyo5zak3d767iFDL8vz_4=ZBHpOtrghw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f6a2529920cff76cb6e37ea840122574404dde8b

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 6 ++++
src/test/regress/expected/sqljson_jsontable.out | 44 ++++++++++++------------
src/test/regress/expected/sqljson_queryfuncs.out | 26 +++++++-------
3 files changed, 41 insertions(+), 35 deletions(-)