Re: [PG19] Wrong results from NOT NULL-based expression simplification - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: [PG19] Wrong results from NOT NULL-based expression simplification
Date
Msg-id CAHGQGwHmL1M2S5vmoNAMm2aSP9uFnXEE9GQmvnbo3SyWcb9knQ@mail.gmail.com
Whole thread
In response to Re: [PG19] Wrong results from NOT NULL-based expression simplification  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: [PG19] Wrong results from NOT NULL-based expression simplification
List pgsql-hackers
On Sun, Oct 11, 2026 at 9:36 AM Richard Guo <guofenglinux@gmail.com> wrote:
> I plan to back-patch this to v19 only, after rc1.

Thanks for the patch!

Codex reported that the following INSERT, which previously succeeded, still
fails with this patch. I confirmed the issue. Should we fix this as well?

------------------------------------------
CREATE FUNCTION f(numeric) RETURNS numeric
LANGUAGE sql IMMUTABLE AS 'SELECT $1';

CREATE TABLE t (a numeric(10) NOT NULL);

CREATE UNIQUE INDEX ON t (
    NULLIF(f(a), CASE WHEN a IS NULL THEN a END)
);

INSERT INTO t VALUES (1)
ON CONFLICT (NULLIF(f(a), CASE WHEN a IS NULL THEN a END))
DO NOTHING;
------------------------------------------

Regards,

--
Fujii Masao



pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: [PG19] Wrong results from NOT NULL-based expression simplification
Next
From: shihao zhong
Date:
Subject: Re: Assert failure in find_var_for_subquery_tle