Re: BUG #19418: SQL/JSON JSON_VALUE() does not conform to ISO/IEC 9075-2:2023(E) 6.34 - Mailing list pgsql-bugs

From Richard Guo
Subject Re: BUG #19418: SQL/JSON JSON_VALUE() does not conform to ISO/IEC 9075-2:2023(E) 6.34
Date
Msg-id CAMbWs4_f-4BqvfKTt0YbkOky+Gf0Mpi2kCT3CAE8brZFnK275Q@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19418: SQL/JSON JSON_VALUE() does not conform to ISO/IEC 9075-2:2023(E) 6.34  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: BUG #19418: SQL/JSON JSON_VALUE() does not conform to ISO/IEC 9075-2:2023(E) 6.34
List pgsql-bugs
On Fri, Feb 27, 2026 at 11:44 PM Richard Guo <guofenglinux@gmail.com> wrote:
> I wonder if we can fix it by wrapping the JSON_ARRAYAGG in a COALESCE
> to catch the NULL and convert it to an empty array; ie:
>
> SELECT COALESCE(
>     JSON_ARRAYAGG(a [FORMAT] [RETURNING] [ON NULL]),
>     '[]'::[RETURNING_TYPE]
> ) FROM (query) q(a)

The attached patch seems to fix it.

- Richard

Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #19421: PostgreSQL MERGE Crash: heap_compute_data_size() at heaptuple.c:236
Next
From: Richard Guo
Date:
Subject: Re: BUG #19418: SQL/JSON JSON_VALUE() does not conform to ISO/IEC 9075-2:2023(E) 6.34