pgsql: Handle INSERT .. ON CONFLICT with partitioned tables

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Handle INSERT .. ON CONFLICT with partitioned tables
Date: 2018-03-26 13:44:35
Message-ID: E1f0SQN-0006Q4-P8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/555ee77a9668e3f1b03307055b5027e13bf1a715

Modified Files
--------------
doc/src/sgml/ddl.sgml | 15 --
doc/src/sgml/ref/insert.sgml | 8 +
src/backend/catalog/partition.c | 88 ++++++++--
src/backend/executor/execMain.c | 4 +
src/backend/executor/execPartition.c | 233 ++++++++++++++++++++++++--
src/backend/executor/nodeModifyTable.c | 74 ++++++--
src/backend/parser/analyze.c | 7 -
src/include/catalog/partition.h | 1 +
src/include/nodes/execnodes.h | 22 ++-
src/include/nodes/nodes.h | 1 +
src/test/regress/expected/insert_conflict.out | 108 ++++++++++--
src/test/regress/expected/triggers.out | 33 ++++
src/test/regress/sql/insert_conflict.sql | 95 +++++++++--
src/test/regress/sql/triggers.sql | 33 ++++
14 files changed, 638 insertions(+), 84 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2018-03-26 14:50:53 Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables
Previous Message Alvaro Herrera 2018-03-26 12:57:25 pgsql: Fix typo