From 555ee77a9668e3f1b03307055b5027e13bf1a715 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 26 Mar 2018 10:43:54 -0300 Subject: Handle INSERT .. ON CONFLICT with partitioned tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit eb7ed3f30634 enabled unique constraints on partitioned tables, but one thing that was not working properly is INSERT/ON CONFLICT. This commit introduces a new node keeps state related to the ON CONFLICT clause per partition, and fills it when that partition is about to be used for tuple routing. Author: Amit Langote, Álvaro Herrera Reviewed-by: Etsuro Fujita, Pavan Deolasee Discussion: https://postgr.es/m/20180228004602.cwdyralmg5ejdqkq@alvherre.pgsql --- doc/src/sgml/ddl.sgml | 15 --------------- doc/src/sgml/ref/insert.sgml | 8 ++++++++ 2 files changed, 8 insertions(+), 15 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 3a54ba9d5a7..8805b88d829 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3322,21 +3322,6 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02 - - - Using the ON CONFLICT clause with partitioned tables - will cause an error if the conflict target is specified (see - for more details on how the clause - works). Therefore, it is not possible to specify - DO UPDATE as the alternative action, because - specifying the conflict target is mandatory in that case. On the other - hand, specifying DO NOTHING as the alternative action - works fine provided the conflict target is not specified. In that case, - unique constraints (or exclusion constraints) of the individual leaf - partitions are considered. - - - When an UPDATE causes a row to move from one diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml index 134092fa9c5..62e142fd8ef 100644 --- a/doc/src/sgml/ref/insert.sgml +++ b/doc/src/sgml/ref/insert.sgml @@ -518,6 +518,14 @@ INSERT INTO table_name [ AS + + + Note that it is currently not supported for the + ON CONFLICT DO UPDATE clause of an + INSERT applied to a partitioned table to update the + partition key of a conflicting row such that it requires the row be moved + to a new partition. + It is often preferable to use unique index inference rather than -- cgit v1.2.3