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 CAHGQGwE6W9u8aRvbnWK0zVPukU46_yZqYL9WHMhfv8LNPN3pBw@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 Sat, Oct 10, 2026 at 9:53 AM Richard Guo <guofenglinux@gmail.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



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Hash index bucket split bug
Next
From: Sho Ito
Date:
Subject: Re: pg_resetwal: add --cluster-state option