Re: [PATCH]Fix planner's strictness check for JsonExpr

From: Keyerror Smart <smartkeyerror(at)gmail(dot)com>
To: Ethan Tran <ethantran(at)quwin(dot)dev>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH]Fix planner's strictness check for JsonExpr
Date: 2026-11-08 23:52:00
Message-ID: CAD=-kXbsgddZeUJKDi5=-rE4pHdvNFYWk0FcE85MCzN4gzo0dQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Ethan,

> Yes, the benchmark used default NULL ON EMPTY/ON ERROR.
>
> On my rerun, v3 now keeps it inlined without any performance issues.

Thanks for rerunning it.

> Would UNKNOWN ON ERROR be worth including, since it is another NULL
> fallback?

Yes, it's the same as NULL ON ERROR, and including it is a one-line
change, so v4 does that. It only applies to JSON_EXISTS, which has no
RETURNING clause, so the domain case doesn't come up. v4 adds a test
that a STRICT SQL function using JSON_EXISTS(... UNKNOWN ON ERROR) is
inlined.

> Constant NULL defaults also seem to fit the NULL-or-error rule,
> but these could be left for a follow-up.

Agreed, I'd leave those for a follow-up. DEFAULT NULL does the same
as NULL, so there's little reason to write it, and I'd rather keep the
back-patched rule to checking the behavior types only.

v4 is also rebased over 627c4df3b73 ("SQL/JSON: Fix NULL result leakage
in JSON_VALUE() RETURNING json/jsonb"), which added regression tests at
the same spot in sqljson_queryfuncs.sql; cfbot was reporting that v3 no
longer applied.

Regards,
Zhenglong Li

Attachment Content-Type Size
v4-0001-Fix-planner-s-strictness-check-for-JsonExpr.patch application/octet-stream 13.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Keyerror Smart 2026-11-09 00:01:33 Re: [PATCH] Consider window functions when reordering GROUP BY items
Previous Message Michael Paquier 2026-11-08 23:11:50 Re: BGWORKER_INTERRUPTIBLE workers are never restarted after DROP/ALTER/CREATE DATABASE