Re: [PG19] Wrong results from NOT NULL-based expression simplification

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, shihao zhong <zhong950419(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: [PG19] Wrong results from NOT NULL-based expression simplification
Date: 2026-10-11 01:50:05
Message-ID: CAHGQGwHmL1M2S5vmoNAMm2aSP9uFnXEE9GQmvnbo3SyWcb9knQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 11, 2026 at 9:36 AM Richard Guo <guofenglinux(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-10-11 02:17:35 Re: Assert failure in find_var_for_subquery_tle
Previous Message Richard Guo 2026-10-11 00:35:55 Re: [PG19] Wrong results from NOT NULL-based expression simplification