Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XlnJO-00038J-6U for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2014 23:14:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XlnJN-0006Dp-IW for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2014 23:14:53 +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 1XlnJM-0006Dd-On; Tue, 04 Nov 2014 23:14:52 +0000 Received: from dd2030.kasserver.com ([85.13.128.37]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XlnJI-00025r-Lr; Tue, 04 Nov 2014 23:14:51 +0000 Received: from [192.168.1.201] (dslb-084-062-020-174.084.062.pools.vodafone-ip.de [84.62.20.174]) by dd2030.kasserver.com (Postfix) with ESMTPSA id 996F6E0251; Wed, 5 Nov 2014 00:14:44 +0100 (CET) Date: Wed, 05 Nov 2014 00:14:42 +0100 From: Bernd Helmle To: Tom Lane , Andres Freund cc: Sven Wegener , pgsql-hackers@postgresql.org, pgsql-general@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: [GENERAL] Re: [BUGS] COPY TO returning empty result with parallel ALTER TABLE Message-ID: In-Reply-To: <20002.1415139494@sss.pgh.pa.us> References: <12887.1415127083@sss.pgh.pa.us> <20141104200328.GR28295@alap3.anarazel.de> <20002.1415139494@sss.pgh.pa.us> X-Mailer: Mulberry/4.1.0a3 (Mac OS X) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline; size=796 X-Pg-Spam-Score: -1.9 (-) 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 4. November 2014 17:18:14 -0500 Tom Lane wrote: > Yeah, and I think that it's entirely reasonable for rewriting ALTER TABLEs > to update the xmin of the rewritten tuples; after all, the output data > could be arbitrarily different from what the previous transactions put > into the table. But that is not the question here. If the COPY blocks > until the ALTER completes --- as it must --- why is its execution snapshot > not taken *after* the lock is acquired? COPY waits in DoCopy() but its snapshot gets acquired in PortalRunUtility() earlier. SELECT has it's lock already during transform/analyse phase and its snapshot is taken much later. Looks like we need something that analyses a utility statement to get its lock before executing. -- Thanks Bernd -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers