Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XljCW-00015R-I0 for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Nov 2014 18:51:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XljCV-0005Q4-Sa for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Nov 2014 18:51:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XljCU-0005Pp-Ra; Tue, 04 Nov 2014 18:51:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XljCR-0006Hd-MG; Tue, 04 Nov 2014 18:51:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id sA4IpNWM012888; Tue, 4 Nov 2014 13:51:23 -0500 From: Tom Lane To: Bernd Helmle cc: Sven Wegener , pgsql-hackers@postgresql.org, pgsql-general@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: [HACKERS] COPY TO returning empty result with parallel ALTER TABLE In-reply-to: References: Comments: In-reply-to Bernd Helmle message dated "Tue, 04 Nov 2014 19:23:21 +0100" Date: Tue, 04 Nov 2014 13:51:23 -0500 Message-ID: <12887.1415127083@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Bernd Helmle writes: > --On 3. November 2014 18:15:04 +0100 Sven Wegener > 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? What concerns me more is whether there are other utility statements that have comparable issues. We should not fix just COPY if there are more cases. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs