Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwg2X-0002W4-A6 for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Jun 2021 07:14:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwg2V-0002X2-T0 for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Jun 2021 07:14:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwg2V-0002Wu-EJ for pgsql-hackers@lists.postgresql.org; Fri, 25 Jun 2021 07:14:11 +0000 Received: from codesynthesis.com ([188.40.148.39]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwg2O-0001GB-N3 for pgsql-hackers@lists.postgresql.org; Fri, 25 Jun 2021 07:14:10 +0000 Received: from brak.codesynthesis.com (unknown [105.225.47.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by codesynthesis.com (Postfix) with ESMTPSA id C30375F300; Fri, 25 Jun 2021 07:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codesynthesis.com; s=mail1; t=1624605239; bh=72wVlukMMEmFD811UWY+e2cdClN6eUIBCuQ1dJQYkKc=; h=Date:From:To:Subject:Message-ID:MIME-Version:From; b=gXnkXwI/c7tGphake0QwhJ7F/dU/8SqD5HhM2lV9f3D+DotHvj6cGZ41EKxwa2hbZ xRe/gcnAH2p5YiI1QkDmqJNQkbyUMTEjTajeU4RO5cfTI2Eydj/BNMibJjUG7UEKw4 kUDhb39uUwWH5EWRgei5I/GVJvKbNm8q63MsDGpXPPkyDSGIAjP0FChKoqmAmQKK5X rL+SI7V+AtWWENAockMuSpv0iawpHpb4Lvyb+S11bX8LkphwA3fMCE9kjI6Tkgn6UM UDzozDtS74c438p/Q/OV93yQzE2G0QtJoiqVuTYxw3I/rVjjQeXSKp/tkTEcqRvXie OWo97qg2pFM4w== Received: by brak.codesynthesis.com (Postfix, from userid 1000) id 936EC1A802C0; Fri, 25 Jun 2021 09:13:53 +0200 (SAST) Date: Fri, 25 Jun 2021 09:13:53 +0200 From: Boris Kolpackov To: Alvaro Herrera Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Pipeline mode and PQpipelineSync() Message-ID: References: <202106242232.vpewlschvxfv@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202106242232.vpewlschvxfv@alvherre.pgsql> Organization: Code Synthesis User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > IIUC the problem is that PQgetResult is indeed not prepared to deal with > a result the first time until after the queue has been "prepared", and > this happens on calling PQpipelineSync. But I think the formulation in > the attached patch works too, and the resulting code is less surprising. > > I wrote a test case that works as you describe, and indeed with the > original code it gets a NULL initially; that disappears with the > attached patch. Can you give it a try? Yes, I can confirm this appears to have addressed the first issue, thanks! The second issue [1], however, is still there even with this patch. [1] https://www.postgresql.org/message-id/boris.20210624103805%40codesynthesis.com