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 1n7jT4-0001gW-Dd for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Jan 2022 19:39:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n7jT2-0005W5-SJ for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Jan 2022 19:39:32 +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 1n7jT2-0005Vu-Ir for pgsql-hackers@lists.postgresql.org; Wed, 12 Jan 2022 19:39:32 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7jSw-0004N3-1Y for pgsql-hackers@lists.postgresql.org; Wed, 12 Jan 2022 19:39:31 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 1D7813201DE2; Wed, 12 Jan 2022 14:39:24 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 12 Jan 2022 14:39:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=jfeCSqHC+oHt6rDMZX/44i8eE1DBSvNSBerTxVSFNE8=; b=RPcBoXNv p2+0sf3aUIpSnKUG3LOfkBLdNsyf+5Wkm/kyJdmzOsmC4+pAfiLZDrvtv/VM3neh o5Jfz+2Edid0IqlgayiZtoe1U5vV6nyfp/GkXigjJI7LwGVpSo1msGzrdw5R4sNO 27ynMMBhdcNBnH7ht2yQwew9gL4oy+Ogiym8nLASqLAFm18l4qX5jQl5FPSdpkxx GSZggdlIvx9aklGd1VVF8H1IM5mexoc4Osds3PDXtv4Z2iOe7CdcbuPR3r6Ylfgl 9jqztP97xCSheXHqIJbv32pMBfAJ7wRj9cRweFjSUN8JSIUHIxbUpaxQZ04sRPFv iyIbjUL7fXEqTw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrtddugddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedujeevjeffjeevuddutedvkeeiueeitddvieelfeekveej udefgeeuvdejhfeuleenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Jan 2022 14:39:22 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 043AB2A06EB; Wed, 12 Jan 2022 16:39:20 -0300 (-03) Date: Wed, 12 Jan 2022 16:39:20 -0300 From: Alvaro Herrera To: Andrei Matei Cc: Tom Lane , pgsql-hackers@lists.postgresql.org Subject: Re: is ErrorResponse possible on Sync? Message-ID: <202201121939.zrszuiavtgy4@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Jan-12, Andrei Matei wrote: > If Sync itself cannot fail, then what is this > sentence really saying: "This parameterless message (ed. Sync) causes the > backend to close the current transaction if it's not inside a BEGIN/COMMIT > transaction block (“close” meaning to commit if no error, or roll back if > error)." ? > This seems to say that, outside of BEGIN/END, the transaction is committed > at Sync time (i.e. if the Sync is never sent, nothing is committed). > Presumably, committing a transaction can fail even if no > previous command/statement failed, right? A deferred trigger can cause a failure at COMMIT time for which no previous error was reported. alvherre=# create table t (a int unique deferrable initially deferred); CREATE TABLE alvherre=# insert into t values (1); INSERT 0 1 alvherre=# begin; BEGIN alvherre=*# insert into t values (1); INSERT 0 1 alvherre=*# commit; ERROR: duplicate key value violates unique constraint "t_a_key" DETALLE: Key (a)=(1) already exists. I'm not sure if you can cause this to explode with just a Sync message, though. -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/