pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix incorrect index behavior in COPY FROM with partitioned table
Date: Wed, 05 Jun 2019 06:35:52 +0000
Message-ID: <E1hYPWa-0006kx-T3@gemulon.postgresql.org> (raw)

Fix incorrect index behavior in COPY FROM with partitioned tables

86b85044e rewrote how COPY FROM works to allow multiple tuple buffers to
exist to once thus allowing multi-inserts to be used in more cases with
partitioned tables.  That commit neglected to update the estate's
es_result_relation_info when flushing the insert buffer to the partition
making it possible for the index tuples to be added into an index on the
wrong partition.

Fix this and also add an Assert in ExecInsertIndexTuples to help ensure
that we never make this mistake again.

Reported-by: Haruka Takatsuka
Author: Ashutosh Sharma
Discussion: https://postgr.es/m/15832-b1bf336a4ee246b5@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/56b3b3838284f53c83556592e60688522155f57f

Modified Files
--------------
src/backend/commands/copy.c         |  3 +++
src/backend/executor/execIndexing.c |  3 +++
src/test/regress/input/copy.source  | 13 +++++++++++++
src/test/regress/output/copy.source | 17 +++++++++++++++++
4 files changed, 36 insertions(+)



Message-ID: <E1hYPWa-0006kx-T3@gemulon.postgresql.org>
Permalink:  ../E1hYPWa-0006kx-T3@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hYPWa-0006kx-T3@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org
  Subject: Re: pgsql: Fix incorrect index behavior in COPY FROM with partitioned table
  In-Reply-To: <E1hYPWa-0006kx-T3@gemulon.postgresql.org>
  References: <E1hYPWa-0006kx-T3@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox