pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY
2+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2024-04-18 2c7cea5a8e  Fix object name clash in recently introduced test
* pgsql: SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY
@ 2024-04-18 06:51 Amit Langote <amitlan@postgresql.org>
  2024-04-18 08:15 ` Re: pgsql: SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY Amit Langote <amitlangote09@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Amit Langote @ 2024-04-18 06:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY

SQL/JSON query functions allow specifying an expression to return
when either of ON ERROR or ON EMPTY condition occurs when evaluating
the JSON path expression.  The parser (transformJsonBehavior()) checks
that the specified expression is one of the supported expressions, but
there are two issues with how the check is done that are fixed in this
commit:

* No check for some expressions related to coercion, such as
  CoerceViaIO, that may appear in the transformed user-specified
  expressions that include cast(s)

* An unsupported expression may be masked by a coercion-related
  expression, which must be flagged by checking the latter's
  argument expression recursively

Author: Jian He <jian.universality@gmail.com>
Author: Amit Langote <amitlangote09@gmail.com>
Reported-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxEqhqsfrg_p7EMyo5zak3d767iFDL8vz_4%3DZBHpOtrghw@mail.gmail.com
Discussion: https://postgr.es/m/CACJufxGOerH1QJknm1noh-Kz5FqU4p7QfeZSeVT2tN_4SLXYNg@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/parser/parse_expr.c                  | 37 ++++++++++++++-
src/test/regress/expected/sqljson_jsontable.out  | 32 +++++++++++++
src/test/regress/expected/sqljson_queryfuncs.out | 57 ++++++++++++++++++++++++
src/test/regress/sql/sqljson_jsontable.sql       | 16 +++++++
src/test/regress/sql/sqljson_queryfuncs.sql      | 27 +++++++++++
5 files changed, 167 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY
  2024-04-18 06:51 pgsql: SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY Amit Langote <amitlan@postgresql.org>
@ 2024-04-18 08:15 ` Amit Langote <amitlangote09@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Langote @ 2024-04-18 08:15 UTC (permalink / raw)
  To: Amit Langote <amitlan@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

On Thu, Apr 18, 2024 at 3:51 PM Amit Langote <amitlan@postgresql.org> wrote:
> SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY
>
> SQL/JSON query functions allow specifying an expression to return
> when either of ON ERROR or ON EMPTY condition occurs when evaluating
> the JSON path expression.  The parser (transformJsonBehavior()) checks
> that the specified expression is one of the supported expressions, but
> there are two issues with how the check is done that are fixed in this
> commit:
>
> * No check for some expressions related to coercion, such as
>   CoerceViaIO, that may appear in the transformed user-specified
>   expressions that include cast(s)
>
> * An unsupported expression may be masked by a coercion-related
>   expression, which must be flagged by checking the latter's
>   argument expression recursively
>
> Author: Jian He <jian.universality@gmail.com>
> Author: Amit Langote <amitlangote09@gmail.com>
> Reported-by: Jian He <jian.universality@gmail.com>
> Discussion: https://postgr.es/m/CACJufxEqhqsfrg_p7EMyo5zak3d767iFDL8vz_4%3DZBHpOtrghw@mail.gmail.com
> Discussion: https://postgr.es/m/CACJufxGOerH1QJknm1noh-Kz5FqU4p7QfeZSeVT2tN_4SLXYNg@mail.gmail.com
>
> Branch
> ------
> master
>
> Details
> -------
> https://git.postgresql.org/pg/commitdiff/c0fc0751862d4e9b7ca9d51f2cd79344690ec873
>
> Modified Files
> --------------
> src/backend/parser/parse_expr.c                  | 37 ++++++++++++++-
> src/test/regress/expected/sqljson_jsontable.out  | 32 +++++++++++++
> src/test/regress/expected/sqljson_queryfuncs.out | 57 ++++++++++++++++++++++++
> src/test/regress/sql/sqljson_jsontable.sql       | 16 +++++++
> src/test/regress/sql/sqljson_queryfuncs.sql      | 27 +++++++++++
> 5 files changed, 167 insertions(+), 2 deletions(-)

Noticed failures on canebrake and urutu that seem to have to do with
using the same DOMAIN name in nearby test files causing a clash.

Will push a fix shortly.

-- 
Thanks, Amit Langote





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-04-18 08:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18 06:51 pgsql: SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY Amit Langote <amitlan@postgresql.org>
2024-04-18 08:15 ` Amit Langote <amitlangote09@gmail.com>

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