pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make COPY TO keep locks until the transaction end.
Date: Fri, 15 May 2020 02:48:11 +0000
Message-ID: <E1jZQOR-0001TR-B2@gemulon.postgresql.org> (raw)

Make COPY TO keep locks until the transaction end.

COPY TO released the ACCESS SHARE lock immediately when it was done rather
than holding on to it until the end of the transaction.

This breaks the case where a REPEATABLE READ transaction could see an
empty table if it repeats a COPY statement and somebody truncated the
table in the meantime.

Before 4dded12faad the lock was also released after COPY FROM, but the
commit failed to notice the irregularity in COPY TO.

This is old behavior but doesn't seem important enough to backpatch.

Author: Laurenz Albe, based on suggestion by Robert Haas and Tom Lane
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/7bcfc39d4176faf85ab317d0c26786953646a411.camel@cybertec.at

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a9cf48a4cf0c878684a2f52a3a88e29399b2065e

Modified Files
--------------
src/backend/commands/copy.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)



Message-ID: <E1jZQOR-0001TR-B2@gemulon.postgresql.org>
Permalink:  ../E1jZQOR-0001TR-B2@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jZQOR-0001TR-B2@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: akapila@postgresql.org
  Subject: Re: pgsql: Make COPY TO keep locks until the transaction end.
  In-Reply-To: <E1jZQOR-0001TR-B2@gemulon.postgresql.org>
  References: <E1jZQOR-0001TR-B2@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