Re: BUG #14351: Upsert not working in case of partitioned tables - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14351: Upsert not working in case of partitioned tables
Date
Msg-id 27411.1475776616@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #14351: Upsert not working in case of partitioned tables  (Marco Colombo <ing.marco.colombo@gmail.com>)
Responses Re: BUG #14351: Upsert not working in case of partitioned tables  (Marco Colombo <ing.marco.colombo@gmail.com>)
List pgsql-bugs
Marco Colombo <ing.marco.colombo@gmail.com> writes:
> Hi, are information provided sufficient to reproduce the problem?

I think you're hoping for a feature that doesn't exist, and is unlikely to
do so anytime soon.  The INSERT ... ON CONFLICT clause describes what to
do in case the unique constraint on table dh_1 is violated.  But it isn't,
since indeed no insert into dh_1 happens at all.  Some other constraint on
some other table is being violated.  The fact that that other insert is
being driven from an ON-INSERT trigger belonging to dh_1 isn't enough to
make a connection --- after all, that trigger could do anything at all.

If we had a true partitioning feature where the connection between the
table insertions was hardwired into the system (rather than emerging from
user-written triggers) and the partitions were all guaranteed to have
identical unique constraints, then it would be reasonable to expect INSERT
... ON CONFLICT to handle conflicts within the partitions.  But we're
still some ways away from having that.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Marco Colombo
Date:
Subject: Re: BUG #14351: Upsert not working in case of partitioned tables
Next
From: hubert depesz lubaczewski
Date:
Subject: Rows go missing when selecting "for update" after savepoint "play"