Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wSRmj-003Bds-2a for pgsql-bugs@arkaria.postgresql.org; Thu, 28 May 2026 03:51:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wSRmg-00B1Nn-1Z for pgsql-bugs@arkaria.postgresql.org; Thu, 28 May 2026 03:51:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wSRmf-00B1Nd-2W for pgsql-bugs@lists.postgresql.org; Thu, 28 May 2026 03:51:51 +0000 Received: from fout-b8-smtp.messagingengine.com ([202.12.124.151]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wSRmd-00000001nW7-39Rx for pgsql-bugs@lists.postgresql.org; Thu, 28 May 2026 03:51:50 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 9102A1D00091; Wed, 27 May 2026 23:51:44 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Wed, 27 May 2026 23:51:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1779940304; x=1780026704; bh=frqAVLFx4T t64STy2Gftsc/N2GdCjif0upFmUkgRjlQ=; b=reUNF20JA/OWMPUtmeKj17PGwN o7YUHA7W5uvlgm7ALBzSvT+C9EBnv39qjZpCrPlIHHs9FFn+K4ZC4/fYz9WwJiFJ fX05DQRWePhhwTUTuou+ge3206J6fQCtEntaJ9e/+0rED1x52f1m3CimlifHcoCp U68XUXVqssMPedprEgB1zkclY0CTD1fF58nJRg+OoSYaDU2ZTzbBRHM/Bm/lGyNF F8+r0Lle0WqgR/JuNN4ranx6c5JNDS0L6v6CuWfIa+zO8q+2VaCLtnyw0/qjq8LS JeqdUbIZlhh+xraVJBL/usa3RWF6YQIEpnjZUUyn2ILM0YKE4XmiG9O/oKdg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1779940304; x=1780026704; bh=frqAVLFx4Tt64STy2Gftsc/N2GdCjif0upF mUkgRjlQ=; b=lLwyn2YDrxUJz5AODsQw+GVWbKZ/o2qabvp7+7fgDkK5YCFbEiw gu5sdgnlK6wzW1t0gHIGtqv+O5QeUj7xtfuGqpQIZxfX241HCOa3A0KU9q1OnLEd VbztQmJQSfrPFtYbsQe2FDZ+TCs8u0uqMPm8Kb9ykz+y8Y/Z9CrYARQFHjeXfwxx /lMfhX/miGiUi0MgmpohOfUZaNarTi0dhGu41UL1cihowhw1tkAF9iMBD25fbd7t dDTxSGR1NodksjdAIM/GlkYaEU6m3BCNg77EZqv5+GR0mamZFj397BInEkS1oPpQ w70y3vwRb8g4YVBdlR6KPP018GmRCBL1DUw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFAq1+pmUvRs2eSu5wtjkgVDeBeHHK1wdb8BxsfnNsOtt3eaEArGF53qAj6bWG2dA K3+qChz0sNdJhHMtM5cFuuk8lO8U3yEKhqrsVmLHsyJgrMY0dyiDugoNlUbYJQOjG/6M6g zZLzqou3/kDZ892ktTnk2qEL5z9mabjrRXBlZJ0hppheGmw6k17kwkgWy5whpZUV6J3QSL EuMvZPjAXT7lOcw9JrysicFMlUKL8md3IL5e7cms5qVrk/3TJUD7+k6VdDn1WQ6eckZEcB TjB7P2PbIdgKkbXRibxVdo2J5IS0EB1iOkjvD2Wi2iscrTAMNFxb54Lc9iWzhjIS+HVNK0 ojCP3Wukgc+23DCnE0uSwiDNRnfIh51VRzTQfAqClRzzVkE36xbUMFKIOlrhbjZOXTv/fl y11GisKtO6JHCQuHtcr/okJhIS7kleGrMQTK8GKMBEP4utgpYv3RCGFSxJPIpOWh22fjeV QXJOOXPHy8bmb4+UBC22DYmh4jQW3xEd6BTbfs8ltJwEGu1XbnjL6JeW5r8VJHlYpxF7Yd nWuHhcKJXQwwufH8VWWKai81PYMvim2sDavz7KaPUmmVhZ+851IRuuJw9xBg1Ac7xE/iIZ P5DYYiTgw6wsLOVq7uz3jTfi3vi9JOw6NQa6GZy/hqKAk9TwIhlFLFsVLXCw X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 27 May 2026 23:51:43 -0400 (EDT) Date: Thu, 28 May 2026 12:51:38 +0900 From: Michael Paquier To: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19494: Error on transaction commit inside pipeline triggers psql's Assert Message-ID: References: <19494-97a86d84fee71c47@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yRRfwbsvs08O+S4M" Content-Disposition: inline In-Reply-To: <19494-97a86d84fee71c47@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --yRRfwbsvs08O+S4M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 26, 2026 at 07:00:01PM +0000, PG Bug reporting form wrote: > The following psql script: > CREATE TABLE t(a INTEGER PRIMARY KEY DEFERRABLE INITIALLY DEFERRED); > \startpipeline > INSERT INTO t VALUES ($1), ($1) RETURNING * \bind 1 \sendpipeline > \endpipeline > > psql: common.c:1503: discardAbortedPipelineResults: Assertion > `pset.available_results > 0' failed. That's one assertion, and with a bit more imagination for a deferred constraint, I can trigger a second one for the number of syncs when at the end of a pipeline: \startpipeline INSERT INTO pipeline_defer_tab VALUES ($1), ($1) \bind 1 \sendpipeline \syncpipeline SELECT 1 \bind \sendpipeline \endpipeline #5 0x000000000041bb0a in ExecQueryAndProcessResults (query=3D0x5db560 "SELECT 1 ", elapsed_msec=3D0x7fffffffc660, svpt_gone_p=3D0x7fffffffc65f, is_watch=3Dfalse, min_rows=3D0, opt=3D0x0, printQueryFout=3D0x0) at common.c:2190 2190 Assert(pset.piped_syncs =3D=3D 0); (gdb) p pset.piped_syncs $1 =3D 1=20 I am completely sure yet, but it looks like we will need to be smarter with the handling of the number of piped commands by tracking them across the syncs in the shape of a queue, or something like that? So it feels like we need to think harder about the tracking of this activity depending on the state of the pipeline we're in. Or we could lift some of these assertions, but that would not be right to me. -- Michael --yRRfwbsvs08O+S4M Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmoXu8oACgkQnvQgOdby QH2gMQ/+Jpftq8HKQFrsY7HRWDn7Ao7p9SkbYmWrtmhTzYG04VlXrtfg5ABI+P3w txH5ImREUGZLlLqe2GQ/KFcavvo9wZ3SC1FqovT2FEdnt4AAEbFV9htK44aQ/+TL QdZTgXVi3gYtDXHkWhRVPfSyijgKtZqjxuy8/MEvWfWDLrE/rrH09KspeGZvbk6w heesJytlPJ/3yegP3FNVJC1LYOfJUVIHrVfgj6ssfx78trcGySn3aZZqyTwllGHP wFGUT9gy+k6RGoP0GBLWPbI+vpadD5jlxaLu/tO1h4AfZG2066RnMjs7II3p4HOs 0Tj/YwaMmNDybbpaIgE8bVnVjkarLIaBAxRs7zdrG+I2VGsWSEEESvJnxG9Z7BpK q5x8zNXXcfb7ZD776HfTedFtiOIwqjxR5E/6mo8VP7m4sjqfcULRQYm9hDZrmQKv cfeKRxTOlkoLJkQzsrbw8DOy6AfSuivc8V47BbM+4KGK8ktcwjFovPxvXJFXouWu aBMhb+V8WSu5RdgXPuRRr/wugV/x8+xTsXpis00hjOVXoBp0wnIIt61pJ0A3OCp6 loNNWjfOApAPrmbRLM2FHhngZe5nrtpNKLz6I3mCkxfc9quNU+7XRB9y/5ZTwJiL A9NSrRExB4+p0EpgffpikNLl8CBL9GBcEx1oBPc+0gybJadXI+I= =Lr8N -----END PGP SIGNATURE----- --yRRfwbsvs08O+S4M--