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

From: Amit Langote <amitlan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: SQL/JSON: Validate values in ON ERROR/EMPTY clauses
Date: 2024-06-28 05:03:33
Message-ID: E1sN3lk-003K41-Df@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)universality(at)gmail(dot)com>
Reviewed-by: Jian He <jian(dot)universality(at)gmail(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2024-06-28 12:45:51 pgsql: Prevent summarizer hang when summarize_wal turned off and back o
Previous Message Michael Paquier 2024-06-28 04:42:04 pgsql: Update modules/injection_points/.gitignore