diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-03-26 10:43:54 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-03-26 10:43:54 -0300 |
commit | 555ee77a9668e3f1b03307055b5027e13bf1a715 (patch) | |
tree | e024aef2f35c73208a7e5f11822d89d97548c6c1 /doc/src | |
parent | 1b89c2188bd38eac68251f16051859996128f2d0 (diff) |
Handle INSERT .. ON CONFLICT with partitioned tables
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
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ddl.sgml | 15 | ||||
-rw-r--r-- | doc/src/sgml/ref/insert.sgml | 8 |
2 files changed, 8 insertions, 15 deletions
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 @@ -3324,21 +3324,6 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02 <listitem> <para> - Using the <literal>ON CONFLICT</literal> clause with partitioned tables - will cause an error if the conflict target is specified (see - <xref linkend="sql-on-conflict" /> for more details on how the clause - works). Therefore, it is not possible to specify - <literal>DO UPDATE</literal> as the alternative action, because - specifying the conflict target is mandatory in that case. On the other - hand, specifying <literal>DO NOTHING</literal> 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. - </para> - </listitem> - - <listitem> - <para> When an <command>UPDATE</command> causes a row to move from one partition to another, there is a chance that another concurrent <command>UPDATE</command> or <command>DELETE</command> misses this row. 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 <replaceable class="parameter">table_name</replaceable> [ AS <replac not duplicate each other in terms of attributes constrained by an arbiter index or constraint. </para> + + <para> + Note that it is currently not supported for the + <literal>ON CONFLICT DO UPDATE</literal> clause of an + <command>INSERT</command> 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. + </para> <tip> <para> It is often preferable to use unique index inference rather than |