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-10 15:37:36
Message-ID: CAHGQGwE6W9u8aRvbnWK0zVPukU46_yZqYL9WHMhfv8LNPN3pBw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 10, 2026 at 9:53 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> The fix covers all three, but I only back-patched it to v19, since
> there are no field reports and it changes the typmod exposed by a
> reduced CASE expression.

Codex reported that commit d8ce0050a6c causes the following INSERT to fail,
and I confirmed it. Is this a bug?

---------------------------------
CREATE TABLE t (a varchar(20) NOT NULL, b varchar(20));
CREATE UNIQUE INDEX t_idx ON t ((COALESCE(NULL::varchar, a, b)));

INSERT INTO t VALUES ('x', 'y')
ON CONFLICT ((COALESCE(NULL::varchar, a, b))) DO NOTHING;

ERROR: there is no unique or exclusion constraint matching the ON
CONFLICT specification
---------------------------------

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sho Ito 2026-10-10 15:47:09 Re: pg_resetwal: add --cluster-state option
Previous Message Peter Geoghegan 2026-10-10 15:27:09 Re: Hash index bucket split bug