pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: gatekeeper.mail@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition
Date: Fri, 13 Nov 2020 11:03:17 -0500
Message-ID: <288078.1605283397@sss.pgh.pa.us> (raw)
In-Reply-To: <16714-dbf5759eba70bfe4@postgresql.org>
References: <16714-dbf5759eba70bfe4@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> insert into tbl values (1, 1, 1, 1, 'b') on conflict (part_key4) do update
> set values_columns = excluded.values_columns;
> -- ERROR:  there is no unique or exclusion constraint matching the ON
> CONFLICT specification

I see no bug here.  The partitioned table indeed does not have any
such index.  Moreover, if you had tried to make one, you would have
gotten

ERROR:  unique constraint on partitioned table must include all partitioning columns
DETAIL:  PRIMARY KEY constraint on table "tbl" lacks column "part_key1" which is part of the partition key.

The short answer here is that uniqueness constraints on the individual
partitions are not a substitute for a constraint on the whole partitioned
table.

			regards, tom lane





view thread (11+ messages)  latest in thread

Message-ID: <288078.1605283397@sss.pgh.pa.us>
Permalink:  ../288078.1605283397@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/288078.1605283397@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gatekeeper.mail@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition
  In-Reply-To: <288078.1605283397@sss.pgh.pa.us>

* 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