Re: pgsql: SQL/JSON: Avoid initializing unnecessary ON ERROR / ON EMPTY ste

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Amit Langote <amitlan(at)postgresql(dot)org>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: SQL/JSON: Avoid initializing unnecessary ON ERROR / ON EMPTY ste
Date: 2024-09-06 03:44:35
Message-ID: CA+HiwqHEFbjS5_dNBo39NmT-j7vTdmZn7HNM1ZN0-NjUfSBxFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Fri, Sep 6, 2024 at 12:07 PM Amit Langote <amitlan(at)postgresql(dot)org> wrote:
> SQL/JSON: Avoid initializing unnecessary ON ERROR / ON EMPTY steps
>
> When the ON ERROR / ON EMPTY behavior is to return NULL, returning
> NULL directly from ExecEvalJsonExprPath() suffices. Therefore, there's
> no need to create separate steps to check the error/empty flag or
> those to evaluate the the constant NULL expression. This speeds up
> common cases because the default ON ERROR / ON EMPTY behavior for
> JSON_QUERY() and JSON_VALUE() is to return NULL. However, these steps
> are necessary if the RETURNING type is a domain, as constraints on the
> domain may need to be checked.
>
> Reported-by: Jian He <jian(dot)universality(at)gmail(dot)com>
> Author: Jian He <jian(dot)universality(at)gmail(dot)com>
> Author: Amit Langote <amitlangote09(at)gmail(dot)com>
> Discussion: https://postgr.es/m/CACJufxEo4sUjKCYtda0_qt9tazqqKPmF1cqhW9KBOUeJFqQd2g@mail.gmail.com
> Backpatch-through: 17
>
> Branch
> ------
> master
>
> Details
> -------
> https://git.postgresql.org/pg/commitdiff/3a97460970f344660971ee75d7f5a181bf87f633
>
> Modified Files
> --------------
> src/backend/executor/execExpr.c | 30 ++++++++++++++++++++++--------
> 1 file changed, 22 insertions(+), 8 deletions(-)

This or one of the other of my recent commits have broken some BF
animals, so reverting for now.

--
Thanks, Amit Langote

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2024-09-06 03:56:15 pgsql: Revert recent SQL/JSON related commits
Previous Message Amit Langote 2024-09-06 03:07:27 pgsql: SQL/JSON: Avoid initializing unnecessary ON ERROR / ON EMPTY ste