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

From: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
To: zengman <zengman(at)halodbtech(dot)com>
Cc: 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-04 10:38:27
Message-ID: CAB8bMitawD=ERVLwYuDXvMT_OJqf+qAKx=3GEH6V_WHT7jnq7A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

вт, 18 авг. 2026 г. в 13:56, Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>:

>
> вт, 18 авг. 2026 г. в 07:06, zengman <zengman(at)halodbtech(dot)com>:
>
>> I tested the current patch, but it does not seem to address the problem I
>> reported here:
>> ```
>>
>> https://www.postgresql.org/message-id/19625-683b498c92087bc8%40postgresql.org
>> ```
>>
> Dear Zeng,
>
> One is per-row executor state. The other is a wrong parse-time rewrite of
> a boolean DEFAULT. They share only that both involve SQL/JSON DEFAULT.
> Combining them would mix an executor opcode change with a parser coercion
> change, and it would make review and back-patching harder.
>
>
Dear Amit,

Attached is v2 of the patch.
v1 was a malformed unified diff: three context lines after the
ExecEvalJsonIsPredicate hunk were missing the leading space, so
git apply rejected the file as corrupt. There is no code change
versus v1.

I also re-checked the reporter's JSON_EXISTS / JSON_VALUE /
JSON_QUERY examples from the later duplicate report [0]; they pass
with this patch.

[0]
https://www.postgresql.org/message-id/19654-3acd06154d027634@postgresql.org

--
Regards,
Rachitskiy Andrey

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Peter Eisentraut 2026-09-04 10:25:10 Re: BUG #19545: Integer truncation of `GinTuple.keylen` causes out-of-bounds read in parallel GIN index build