Re: BUG #19871: JSON_TABLE evaluates each PASSING argument once per column - a named variable $v gets different valu

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: "303677365(at)qq(dot)com" <303677365(at)qq(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19871: JSON_TABLE evaluates each PASSING argument once per column - a named variable $v gets different valu
Date: 2026-11-30 06:10:48
Message-ID: CAKFQuwYxvgaFm66iSoPxNm0X3Hn-MzooSfpku2ASw+8vPf8kqQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sunday, November 29, 2026, shihao zhong <zhong950419(at)gmail(dot)com> wrote:

> Hi ChunLing,
>
> Thanks for reporting that and I can reproduce it.
>
> I am leaning into not a bug for that report because each JSON_TABLE
> column is evaluated like its own JSON_VALUE() call with the same PASSING
> clause,
> and the docs don't promise that the arguments are evaluated only once. And
> it only shows
> with a volatile argument.
>
>
Be nice to know whether the standard we are trying to conform to has a say
on the matter. If we are keeping this we at least need to try and document
it like we document how a composite typed function output can lead to
multiple execution:

SELECT (myfunc(x)).* FROM some_table;

SELECT (myfunc(x)).a,
(myfunc(x)).b,
(myfunc(x)).c FROM some_table;

https://www.postgresql.org/docs/current/rowtypes.html

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Henson Choi 2026-11-30 07:29:13 Re: BUG #19911: Window aggregate over ROWS n FOLLOWING: "unexpected end of tuplestore" after spill
Previous Message Ayush Tiwari 2026-11-30 05:45:21 Re: BUG #19824: OMIT QUOTES breaks non-string results: array / composite / array-domain coercions in JSON_QUERY / JS