Re: BUG #14132: ON CONFLICT not inferring unique index with bigints - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14132: ON CONFLICT not inferring unique index with bigints
Date
Msg-id 15186.1462977205@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14132: ON CONFLICT not inferring unique index with bigints  (fiercetuba@protonmail.com)
Responses Re: BUG #14132: ON CONFLICT not inferring unique index with bigints
List pgsql-bugs
fiercetuba@protonmail.com writes:
> This fails, but change bigint to int and it works fine.

Looks like somebody forgot to run the ON CONFLICT list through
expression preprocessing.  Unfortunately it's too late to get
this fixed in tomorrow's releases :-(

As a workaround for this particular example, you could write either

INSERT INTO testtable(b, c)
VALUES (1, 2)
ON CONFLICT ((COALESCE(b, '0'::int8)), (COALESCE(c, '0'::int8))) DO NOTHING;

INSERT INTO testtable(b, c)
VALUES (1, 2)
ON CONFLICT ((COALESCE(b, '0')), (COALESCE(c, '0'))) DO NOTHING;

but in general there might not be any such easy solution.

            regards, tom lane

pgsql-bugs by date:

Previous
From: David Rowley
Date:
Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices
Next
From: Mathias Kunter
Date:
Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices