Re: BUG #19418: SQL/JSON JSON_VALUE() does not conform to ISO/IEC 9075-2:2023(E) 6.34 <JSON value constructor>

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Vik Fearing <vik(at)postgresfriends(dot)org>, lukas(dot)eder(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Subject: Re: BUG #19418: SQL/JSON JSON_VALUE() does not conform to ISO/IEC 9075-2:2023(E) 6.34 <JSON value constructor>
Date: 2026-03-03 01:03:49
Message-ID: CAMbWs49P2z40f5yb_97ErwtC9ocdR5QQN0gWUZtjgot9+iGAcg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Mar 2, 2026 at 3:37 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> ... doesn't that point disqualify it from being back-patched?
> People don't like unprompted behavioral changes in minor releases.
> "This is what the standard says" is not strong enough to justify
> changing behavior that was not obviously broken (like, say, crashing).

Fair point. Changing user-facing output is not something we want to
surprise users with in a minor release. So this will be a master-only
fix.

> Another point is that the previous coding already failed to
> be round-trippable, ie you wrote JSON_ARRAY() but what comes
> out in view decompilation is JSON_ARRAYAGG(). This makes that
> situation considerably worse. We should endeavor to not expose
> implementation details like that. (To be clear, I don't object
> if EXPLAIN shows that sort of thing. But it shouldn't creep
> into view dumps. We've regretted doing that in the past.)

That is a good point I hadn't considered. So I think the ideal fix is
to have the parser preserve the user's original JSON_ARRAY(query)
syntax as much as possible, and then defer the JSON_ARRAYAGG rewrite
trick to the planner, perhaps during expression preprocessing.

- Richard

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message jian he 2026-03-03 02:41:47 Re: BUG #19418: SQL/JSON JSON_VALUE() does not conform to ISO/IEC 9075-2:2023(E) 6.34 <JSON value constructor>
Previous Message surya poondla 2026-03-02 22:45:32 Re: Two issues with REFRESH MATERIALIZED VIEW CONCURRENTLY