Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY - Mailing list pgsql-bugs

From jian he
Subject Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY
Date
Msg-id CACJufxFL-xzeD_GVVqbd1Jeab8unkbibM_=1cLBUASyi2bDx=g@mail.gmail.com
Whole thread
In response to Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY  (Andrey Rachitskiy <pl0h0yp1@gmail.com>)
Responses Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY
Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY
List pgsql-bugs
On Fri, Sep 4, 2026 at 6:38 PM Andrey Rachitskiy <pl0h0yp1@gmail.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

pgsql-bugs by date:

Previous
From: Rahul Yadav
Date:
Subject: Re: BUG #19670: Silent Integer Overflow in time_pl_interval() Returns Wrong Time Value
Next
From: Tom Lane
Date:
Subject: Re: BUG #19718: pg_dump -Ft: restore.sql gets "\unrestrict (null)"/"_estrict (null)", so psql skips \i data files