Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
Cc: zengman <zengman(at)halodbtech(dot)com>, syzhong16 <syzhong16(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Amit Langote <amitlangote09(at)gmail(dot)com>
Subject: Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY
Date: 2026-09-26 16:28:59
Message-ID: CACJufxFL-xzeD_GVVqbd1Jeab8unkbibM_=1cLBUASyi2bDx=g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Sep 4, 2026 at 6:38 PM Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com> wrote:
>
> Attached is v2 of the patch.
>
> --
> Regards,
> Rachitskiy Andrey

+ EEO_CASE(EEOP_JSONEXPR_RESET)
+ {
+ ExecEvalJsonExprReset(state, op);
+
+ EEO_NEXT();
+ }
+

--- a/src/include/executor/execExpr.h
+++ b/src/include/executor/execExpr.h
@@ -265,6 +265,7 @@ typedef enum ExprEvalOp
EEOP_XMLEXPR,
EEOP_JSON_CONSTRUCTOR,
EEOP_IS_JSON,
+ EEOP_JSONEXPR_RESET,
EEOP_JSONEXPR_PATH,
EEOP_JSONEXPR_COERCION,
EEOP_JSONEXPR_COERCION_FINISH,

This seems unnecessary.
In EEOP_JSONEXPR_PATH, we can
if document or jsonpath is NULL, we can just go to jump_end (return
NULL) or jump_eval_coercion (NULL need coerce to constrainted domain),
no need to worry about ON ERROR, ON EMPTY.

What do you think of the attachment?

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
v3-0001-Reset-JsonExpr-empty-error-flags-before-NULL-short-circuit.patch text/x-patch 8.6 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-09-26 16:40:04 Re: BUG #19718: pg_dump -Ft: restore.sql gets "\unrestrict (null)"/"\restrict (null)", so psql skips \i data files
Previous Message Rahul Yadav 2026-09-26 15:25:21 Re: BUG #19670: Silent Integer Overflow in time_pl_interval() Returns Wrong Time Value