Re: BUG #19872: JSON_TABLE: an UNUSED PASSING argument's COLLATE leaks into the output columns (wrong results, persi

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, shihao zhong <zhong950419(at)gmail(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, 303677365(at)qq(dot)com
Subject: Re: BUG #19872: JSON_TABLE: an UNUSED PASSING argument's COLLATE leaks into the output columns (wrong results, persi
Date: 2026-12-02 22:41:07
Message-ID: CAN4CZFNfs06JaKodejB9qvGvPD8y5p96eU+x=LwfGOuUih3CsA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello

(I only looked at v2)

jsexpr->collation = InvalidOid;
}

+ jsexpr->collation = get_typcollation(jsexpr->returning->typid);

This seems redundant, we definitely don't need both.

+ case T_JsonExpr:
+ {

We don't need a check_stack_depth somewhere around in this?

> A COLLATE
> inside DEFAULT can also change the result collation, so I would keep
> 0002 as it is.

I think Shihao meant this, where your patch differs now compared to master:

SELECT JSON_VALUE(jsonb '"a"', '$' RETURNING text DEFAULT ('z' COLLATE
"default") ON EMPTY) = label FROM t_label;
-- master: f patched: t

SELECT JSON_VALUE(jsonb '{}', '$.a' RETURNING d_ci DEFAULT 'A' COLLATE
ci ON EMPTY) = label_c FROM t_label;
-- master: t patched: ERROR: could not determine which collation to
use for string comparison

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-12-02 22:52:23 Re: Regex fails to capture group consisting of empty string in non-greedy case
Previous Message Tom Lane 2026-12-02 22:39:41 Re: BUG #19964: ltree GiST index returns too few rows for lquery with a {0,n} quantifier