pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tiago.babo@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14526: no unique or exclusion constraint matching the ON CONFLICT
Date: Thu, 02 Feb 2017 14:07:01 +0000
Message-ID: <20170202140701.1401.31196@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14526
Logged by:          Tiago Babo
Email address:      tiago.babo@gmail.com
PostgreSQL version: 9.5.5
Operating system:   Ubuntu 14.04.2 LTS
Description:        

I'm getting the following error when doing the following type of insert:

Errpr:
SQL execution failed (Reason: ERROR: there is no unique or exclusion
constraint matching the ON CONFLICT specification)

Query:
INSERT INTO accounts (type, person_id) VALUES ('PersonAccount', 1) ON
CONFLICT (type, person_id) WHERE type = 'PersonAccount' DO UPDATE SET
updated_at = EXCLUDED.updated_at RETURNING *

I also have an unique INDEX:

CREATE UNIQUE INDEX uniq_person_accounts ON accounts USING btree (type,
person_id) WHERE ((type)::text = 'PersonAccount'::text);

The thing is that sometimes it works, but not every time. I "randomly" get
that exception, which is really strange. It seems that it can't access that
INDEX or it doesn't know it exists.

Any suggestion?


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


view thread (32+ messages)  latest in thread

Message-ID: <20170202140701.1401.31196@wrigleys.postgresql.org>
Permalink:  ../20170202140701.1401.31196@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20170202140701.1401.31196@wrigleys.postgresql.org

 · 

reply

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
  Subject: Re: BUG #14526: no unique or exclusion constraint matching the ON CONFLICT
  In-Reply-To: <20170202140701.1401.31196@wrigleys.postgresql.org>
  References: <20170202140701.1401.31196@wrigleys.postgresql.org>

* 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