Re: UPSERT strange behavior

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Ivan Frolkov <ifrol2001(at)mail(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: UPSERT strange behavior
Date: 2016-08-25 17:08:35
Message-ID: CAM3SWZSB8RGrkYRCV5ahrOTOktUjnjQcKQeYKCK9x7W9-wWa1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 25, 2016 at 7:12 AM, Ivan Frolkov <ifrol2001(at)mail(dot)ru> wrote:
> So, if we have primary key and unique constraint on a table then upsert will
> not work as would expected.

Why is this unexpected?

You only take the alternative path (UPDATE) in the event of a would-be
duplicate violation. You can't upsert while using more than one index
as an arbiter index. This is true unless they're more or less
equivalent, in which case multiple arbiter indexes can be inferred,
but that clearly doesn't apply here.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-08-25 17:12:44 Re: increasing the default WAL segment size
Previous Message Magnus Hagander 2016-08-25 17:05:28 Re: increasing the default WAL segment size