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: Validate values in ON ERROR/EMPTY clauses
Date: Fri, 28 Jun 2024 05:03:33 +0000
Message-ID: <E1sN3lk-003K41-Df@gemulon.postgresql.org> (raw)

SQL/JSON: Validate values in ON ERROR/EMPTY clauses

Currently, the grammar allows any supported values in the ON ERROR
and ON EMPTY clauses for SQL/JSON functions, regardless of whether
the values are appropriate for the function. This commit ensures
that during parse analysis, the provided value is checked for
validity for the given function and throws a syntax error if it is
not.

While at it, this fixes some omissions in the documentation of the
ON ERROR/EMPTY clauses for JSON_TABLE().

Reported-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxFgWGqpESSYzyJ6tSurr3vFYBSNEmCfkGyB_dMdptFnZQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/55e56c84da99fe7becda2194563f48bb3083c2d1

Modified Files
--------------
doc/src/sgml/func.sgml                           |   6 +-
src/backend/parser/parse_expr.c                  | 126 +++++++++++++++++++++--
src/backend/parser/parse_jsontable.c             |   2 +-
src/test/regress/expected/sqljson_jsontable.out  |  26 ++++-
src/test/regress/expected/sqljson_queryfuncs.out |  16 +++
src/test/regress/sql/sqljson_jsontable.sql       |   7 ++
src/test/regress/sql/sqljson_queryfuncs.sql      |   5 +
7 files changed, 174 insertions(+), 14 deletions(-)



Message-ID: <E1sN3lk-003K41-Df@gemulon.postgresql.org>
Permalink:  ../E1sN3lk-003K41-Df@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sN3lk-003K41-Df@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: Validate values in ON ERROR/EMPTY clauses
  In-Reply-To: <E1sN3lk-003K41-Df@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