Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition
Date
Msg-id 288078.1605283397@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: "范孝剑(康贤)"
Date:
Subject: 回复:SnapBuildSerialize function forgot pfree variable ondisk_c
Next
From: PG Bug reporting form
Date:
Subject: BUG #16716: postgresql11-devel pckage from Refreshing service 'spacewalk' complains about missing