pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Bernd Helmle <mailings@oopsware.de>
Cc: Sven Wegener <sven.wegener@stealer.net>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-general@postgresql.org
Cc: pgsql-bugs@postgresql.org
Subject: Re: COPY TO returning empty result with parallel ALTER TABLE
Date: Tue, 04 Nov 2014 14:33:07 -0500
Message-ID: <545929F3.5030408@dunslane.net> (raw)
In-Reply-To: <12887.1415127083@sss.pgh.pa.us>
References: <alpine.LNX.2.11.1411031751320.29849@titan.int.lan.stealer.net>
	<D19B4DF60D3D403C6E7B61D6@eje.credativ.lan>
	<12887.1415127083@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>


On 11/04/2014 01:51 PM, Tom Lane wrote:
> Bernd Helmle <mailings@oopsware.de> writes:
>> --On 3. November 2014 18:15:04 +0100 Sven Wegener
>> <sven.wegener@stealer.net> wrote:
>>> I've check git master and 9.x and all show the same behaviour. I came up
>>> with the patch below, which is against curent git master. The patch
>>> modifies the COPY TO code to create a new snapshot, after acquiring the
>>> necessary locks on the source tables, so that it sees any modification
>>> commited by other backends.
>> Well, i have the feeling that there's nothing wrong with it. The ALTER
>> TABLE command has rewritten all tuples with its own XID, thus the current
>> snapshot does not "see" these tuples anymore. I suppose that in
>> SERIALIZABLE or REPEATABLE READ transaction isolation your proposal still
>> doesn't return the tuples you'd like to see.
> Not sure.  The OP's point is that in a SELECT, you do get unsurprising
> results, because a SELECT will acquire its execution snapshot after it's
> gotten AccessShareLock on the table.  Arguably COPY should behave likewise.
> Or to be even more concrete, COPY (SELECT * FROM tab) TO ... probably
> already acts like he wants, so why isn't plain COPY equivalent to that?

Yes, that seems like an outright bug.

cheers

andrew


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (9+ messages)  latest in thread

Message-ID: <545929F3.5030408@dunslane.net>
Permalink:  ../545929F3.5030408@dunslane.net/
Also on:    postgresql.org/message-id/545929F3.5030408@dunslane.net

 · 

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-bugs@postgresql.org
  Cc: andrew@dunslane.net, tgl@sss.pgh.pa.us, mailings@oopsware.de, sven.wegener@stealer.net, pgsql-hackers@postgresql.org, pgsql-general@postgresql.org
  Subject: Re: COPY TO returning empty result with parallel ALTER TABLE
  In-Reply-To: <545929F3.5030408@dunslane.net>
  References: <alpine.LNX.2.11.1411031751320.29849@titan.int.lan.stealer.net> <D19B4DF60D3D403C6E7B61D6@eje.credativ.lan> <12887.1415127083@sss.pgh.pa.us> <545929F3.5030408@dunslane.net>

* 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