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: SQL/JSON: Correctly enforce the default ON EMPTY behavior
Date: Wed, 19 Jun 2024 06:48:09 +0000
Message-ID: <E1sJp72-002766-Aa@gemulon.postgresql.org> (raw)

SQL/JSON: Correctly enforce the default ON EMPTY behavior

Currently, when the ON EMPTY clause is not present, the ON ERROR
clause (implicit or explicit) dictates the behavior when jsonpath
evaluation in ExecEvalJsonExprPath() results in an empty sequence.
That is an oversight in the commit 6185c9737c.

This commit fixes things so that a NULL is returned instead in that
case which is the default behavior when the ON EMPTY clause is not
present.

Reported-by: Markus Winand
Discussion: https://postgr.es/m/F7DD1442-265C-4220-A603-CB0DEB77E91D%40winand.at

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/03ec203164119f11f0eab4c83c97a8527e2b108d

Modified Files
--------------
src/backend/parser/parse_expr.c                  | 27 ++++++++++++--------
src/test/regress/expected/sqljson_jsontable.out  | 19 ++++++++++----
src/test/regress/expected/sqljson_queryfuncs.out | 32 +++++++++++++++---------
src/test/regress/sql/sqljson_jsontable.sql       |  8 +++---
src/test/regress/sql/sqljson_queryfuncs.sql      | 18 ++++++-------
5 files changed, 64 insertions(+), 40 deletions(-)



Message-ID: <E1sJp72-002766-Aa@gemulon.postgresql.org>
Permalink:  ../E1sJp72-002766-Aa@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sJp72-002766-Aa@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: amitlan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: SQL/JSON: Correctly enforce the default ON EMPTY behavior
  In-Reply-To: <E1sJp72-002766-Aa@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