pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Langote <amitlan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix JsonExpr deparsing to emit QUOTES and WRAPPER correctly
Date: Mon, 08 Apr 2024 07:15:33 +0000
Message-ID: <E1rtjE5-0015U8-1n@gemulon.postgresql.org> (raw)

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: https://postgr.es/m/CACJufxEqhqsfrg_p7EMyo5zak3d767iFDL8vz_4%3DZBHpOtrghw%40mail.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(-)



Message-ID: <E1rtjE5-0015U8-1n@gemulon.postgresql.org>
Permalink:  ../E1rtjE5-0015U8-1n@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rtjE5-0015U8-1n@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: amitlan@postgresql.org
  Subject: Re: pgsql: Fix JsonExpr deparsing to emit QUOTES and WRAPPER correctly
  In-Reply-To: <E1rtjE5-0015U8-1n@gemulon.postgresql.org>
  References: <E1rtjE5-0015U8-1n@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox