On Fri, Aug 28, 2026 at 4:15 PM Ewan Young <[email protected]> wrote: > CREATE COLLATION ci (provider=icu, locale='und-u-ks-level2', > deterministic=false); > CREATE TABLE cit (t text COLLATE ci); > INSERT INTO cit VALUES ('a'),('A'),('b'); > > -- pushed on master, but v2 keeps the Filter above the grouping > EXPLAIN (COSTS OFF) > SELECT * FROM (SELECT DISTINCT t FROM cit) d > WHERE (CASE t WHEN JSON_OBJECT('a': 'b' RETURNING text) > THEN 1 ELSE 0 END) = 1;
Nice catch. I did not realize CaseTestExpr can be used in a JSON constructor's coercion expression. I've fixed that and then pushed the patch. (Interestingly, eval_const_expressions also mishandles CaseTestExpr in a JSON constructor's coercion expression, and thus has the same bug. See [1].) [1] https://postgr.es/m/CAMbWs48A=vcfbtetkucokno1_0-cu0ambt0m07dm7vj1qyi...@mail.gmail.com - Richard
