agora inbox for pgsql-bugs@postgresql.org  
help / color / mirror / Atom feed
From: Manu <manuelreyesbravo@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Cc: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: syzhong16@gmail.com
Subject: Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY
Date: Wed, 23 Sep 2026 17:12:30 -0300
Message-ID: <179019435072.698927.9020965732916209558@gmail.com> (raw)
In-Reply-To: <CAB8bMitawD=ERVLwYuDXvMT_OJqf+qAKx=3GEH6V_WHT7jnq7A@mail.gmail.com>
References: <CAB8bMitawD=ERVLwYuDXvMT_OJqf+qAKx=3GEH6V_WHT7jnq7A@mail.gmail.com>

Hi Andrey,

I tested v2 on master, REL_18_STABLE and REL_17_STABLE, together with
Srinath's fix for #19695 [1], which touches the same function.  Both
apply cleanly on all three branches, build without warnings, and the
main regression suite passes.  The reported cases now give the right
answer on the three branches:

- #19621: json_value(x, '$.a' RETURNING int DEFAULT 42 ON EMPTY) over
  '{}' then NULL returns 42, NULL (it was 42, 42)
- #19654: json_exists(j, 'strict $.a' FALSE ON ERROR) over '{}' then
  NULL returns false, NULL (it was false, false)

I could not exercise the llvmjit_expr.c part: this machine has no LLVM
build.

One thing for the back-patch.  EEOP_JSONEXPR_RESET is inserted before
EEOP_JSONEXPR_PATH, so every opcode from there to EEOP_LAST changes its
value: 24 of them on REL_17_STABLE and 25 on REL_18_STABLE.  On master
that is fine, but the back branches are under the buildfarm's ABI
compliance check (.abi-compliance-history), and anything built against
a minor release that uses those values would be off by one after the
update.  Putting the new opcode just before EEOP_LAST in the
back-branch versions, with the dispatch table and llvmjit_expr.c
following the same order, would leave the existing values alone.

If you post back-branch versions, I will rerun the same checks on
them.

[1]
https://postgr.es/m/CAFC+b6p8Oo3_pLXPa=DVXx1XDQJ09b2W3U3WKPtkQYyh0z0z-A@mail.gmail.com

Regards,
Manu






view thread (6+ messages)

Message-ID: <179019435072.698927.9020965732916209558@gmail.com>
Permalink:  ../179019435072.698927.9020965732916209558@gmail.com/
Also on:    postgresql.org/message-id/179019435072.698927.9020965732916209558@gmail.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: manuelreyesbravo@gmail.com, pgsql-bugs@lists.postgresql.org, pl0h0yp1@gmail.com, amitlangote09@gmail.com, syzhong16@gmail.com
  Subject: Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY
  In-Reply-To: <179019435072.698927.9020965732916209558@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox