Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xljqz-0002Qk-Cj for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2014 19:33:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xljqy-0007By-2F for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2014 19:33:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xljqx-0007B7-5D; Tue, 04 Nov 2014 19:33:19 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Xljqs-0006Iu-Tr; Tue, 04 Nov 2014 19:33:17 +0000 Received: from mfilter11-d.gandi.net (mfilter11-d.gandi.net [217.70.178.131]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id DEE6041C04F; Tue, 4 Nov 2014 20:33:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter11-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter11-d.gandi.net (mfilter11-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 5KKxuiWkhzFk; Tue, 4 Nov 2014 20:33:11 +0100 (CET) X-Originating-IP: 98.27.58.255 Received: from [192.168.10.146] (cpe-098-027-058-255.nc.res.rr.com [98.27.58.255]) (Authenticated sender: adsend@dunslane.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 2715C41C06D; Tue, 4 Nov 2014 20:33:08 +0100 (CET) Message-ID: <545929F3.5030408@dunslane.net> Date: Tue, 04 Nov 2014 14:33:07 -0500 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Tom Lane , Bernd Helmle CC: Sven Wegener , pgsql-hackers@postgresql.org, pgsql-general@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: COPY TO returning empty result with parallel ALTER TABLE References: <12887.1415127083@sss.pgh.pa.us> In-Reply-To: <12887.1415127083@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 11/04/2014 01:51 PM, Tom Lane wrote: > 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? 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