From: Tiago Babo <tiago.babo@gmail.com>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14526: no unique or exclusion constraint matching the ON CONFLICT
Date: Tue, 7 Feb 2017 23:21:39 +0000
Message-ID: <D7999A4B-2BF0-4BDD-8C42-09F635897C13@gmail.com> (raw)
In-Reply-To: <CAH2-WznXVG2DYXADcr7wXGO+E+YWUrofm4qYat2a-2kbwoD5Xg@mail.gmail.com>
References: <20170202140701.1401.31196@wrigleys.postgresql.org>
<CAH2-Wz=h4uZuFwAPmU3eNZ-mh=PorhSw75Nt0HYgsWV9GtUMOg@mail.gmail.com>
<166D0A9D-162D-4216-9490-3163533166C1@gmail.com>
<14575.1486493671@sss.pgh.pa.us>
<499844AD-291B-40F5-9892-E5591736FD2E@gmail.com>
<22106.1486500247@sss.pgh.pa.us>
<CAH2-Wz=J+AtQg5xEm3y6GUO=KfzqsfKy89Vzn0-NayjkF_baVw@mail.gmail.com>
<CAPsQ5r-2W=cJmJsQfd1qAY=kFuXDnR668iQvL8kTQSCkmoU76w@mail.gmail.com>
<CAH2-WznXVG2DYXADcr7wXGO+E+YWUrofm4qYat2a-2kbwoD5Xg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The only difference (so it seems), is that when it crashes, the person was created in the seconds before creating the account. When it previously exists in the persons table, it never gives the error.
Working example:
INSERT INTO accounts (type, person_id, created_at, updated_at)
VALUES (‘PersonAccount', 137842, '2017-02-07 23:17:37.61', '2017-02-07 23:17:37.61')
ON CONFLICT (type, person_id) WHERE type = ‘PersonAccount' DO UPDATE SET updated_at = EXCLUDED.updated_at RETURNING *
> On 7 Feb 2017, at 22:17, Peter Geoghegan <pg@bowt.ie> wrote:
>
> On Tue, Feb 7, 2017 at 2:15 PM, Tiago Babo <tiago.babo@gmail.com> wrote:
>> Here is an example where it gives the error (I excluded the created_at and
>> updated_at columns in the last e-mail, but they do exist in the table):
>>
>> INSERT INTO accounts (type, person_id) VALUES ('PersonAccount', 69559,
>> '2017-02-03 12:09:27.259', '2017-02-03 12:09:27.259') ON CONFLICT (type,
>> person_id) WHERE type = 'PersonAccount' DO UPDATE SET updated_at =
>> EXCLUDED.updated_at RETURNING *
>
> Can you give an example of where it does actually work? Is there any
> discernible pattern to what each case looks like?
>
>
> --
> Peter Geoghegan
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tiago.babo@gmail.com, pg@bowt.ie, tgl@sss.pgh.pa.us
Subject: Re: BUG #14526: no unique or exclusion constraint matching the ON CONFLICT
In-Reply-To: <D7999A4B-2BF0-4BDD-8C42-09F635897C13@gmail.com>
References: <20170202140701.1401.31196@wrigleys.postgresql.org> <CAH2-Wz=h4uZuFwAPmU3eNZ-mh=PorhSw75Nt0HYgsWV9GtUMOg@mail.gmail.com> <166D0A9D-162D-4216-9490-3163533166C1@gmail.com> <14575.1486493671@sss.pgh.pa.us> <499844AD-291B-40F5-9892-E5591736FD2E@gmail.com> <22106.1486500247@sss.pgh.pa.us> <CAH2-Wz=J+AtQg5xEm3y6GUO=KfzqsfKy89Vzn0-NayjkF_baVw@mail.gmail.com> <CAPsQ5r-2W=cJmJsQfd1qAY=kFuXDnR668iQvL8kTQSCkmoU76w@mail.gmail.com> <CAH2-WznXVG2DYXADcr7wXGO+E+YWUrofm4qYat2a-2kbwoD5Xg@mail.gmail.com> <D7999A4B-2BF0-4BDD-8C42-09F635897C13@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox