Re: BUG #14132: ON CONFLICT not inferring unique index with bigints

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: fiercetuba(at)protonmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14132: ON CONFLICT not inferring unique index with bigints
Date: 2016-05-11 14:33:25
Message-ID: 15186.1462977205@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

fiercetuba(at)protonmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mathias Kunter 2016-05-11 14:41:24 Re: BUG #14107: Major query planner bug regarding subqueries and indices
Previous Message David Rowley 2016-05-11 13:56:24 Re: BUG #14107: Major query planner bug regarding subqueries and indices