Re: INSERT ... ON CONFLICT error messages

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: hlinnaka <hlinnaka(at)iki(dot)fi>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Subject: Re: INSERT ... ON CONFLICT error messages
Date: 2015-05-07 18:16:12
Message-ID: CAM3SWZRo8zoyw0D2T3F1skNyK-jmwOP1u6i7wC1QB6XND9mTDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 5, 2015 at 8:52 AM, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
> I've read through all the error messages in the patch. Some comments:

I'll work through this feedback.

> postgres=# create table foo (id int4);
> CREATE TABLE
> postgres=# create unique index foo_y on foo (id) where id > 0;
> CREATE INDEX
> postgres=# insert into foo values (-1) on conflict (id) where id > 0 do
> nothing;
> ERROR: inferred arbiter partial unique index's predicate does not cover
> tuple proposed for insertion
> DETAIL: ON CONFLICT inference clause implies that the tuple proposed for
> insertion must be covered by the predicate of partial index "foo_y".
>
> I'm surprised. If the inserted value doesn't match the WHERE clause of the
> constraint, there is clearly no conflict, so I would assume the above to
> work without error.

I'm not particularly attached to that behavior. I could revert it.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2015-05-07 18:18:16 PATCH: pgbench allow '=' in \set
Previous Message Peter Geoghegan 2015-05-07 17:41:04 Re: INSERT ... ON CONFLICT syntax issues