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.94.2) (envelope-from ) id 1qmjhD-008lER-Pe for pgsql-bugs@arkaria.postgresql.org; Sat, 30 Sep 2023 23:48:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qmjhC-00Gxkt-Bp for pgsql-bugs@arkaria.postgresql.org; Sat, 30 Sep 2023 23:48:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qmjhB-00GxjH-HE for pgsql-bugs@lists.postgresql.org; Sat, 30 Sep 2023 23:48:26 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qmjh8-007WZU-Ue for pgsql-bugs@lists.postgresql.org; Sat, 30 Sep 2023 23:48:24 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id ADA3C5C0151; Sat, 30 Sep 2023 19:48:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 30 Sep 2023 19:48:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1696117701; x=1696204101; bh=hM 1CYd31YvbabktnZmtGQxQziDC40KQX5Y7DcoRbbrY=; b=OQIjd6z7huLyBncXv/ YcUtrMD/U8A+hx1X5uzM+BbyuRRPjp3Z0COqtr2WMV6gfLO7mu+VopwNqTxTGKkV gwnoDaSf+MIuEbRGq4Kezh3QNCsx+wyTG30tmymEqQxxQlinb+HnQ0nSrqm8R8Rn 7QGuNBBLvVZAYLZALKr+IfsNyxEYSxuDa6AiFyGqUfeaGf27zfGkhKH2j30c2UYd +4tERO+D/D6hCeVN/tW8nW5L4w0baau2XI2RKCaD7Ew/dQ3+TkGPusXR0wPPcY9M BYej6gRuUkpCKBszrLsD7yfEBoeOxU09Lqle2vsilP2+kT8oAUudD40FO1u2jWmv PjeA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1696117701; x=1696204101; bh=hM1CYd31Yvbab ktnZmtGQxQziDC40KQX5Y7DcoRbbrY=; b=JsQreP78lm9Z0W2ta349FHD2Zlp9w by57kXvxeZkD5TsCw4aZ/aE21gxfXkxccjCWvqWBhUnhQ7Y109ALajY9V/wCwAjt WO0w91iVLipMWimHDNBiLecIXUXsWw/FNs9BV1YtaGWWIEQsl2H01RQkojzj1Beg smA3Kqut44XiecANOYivpP72LaG2gatHno2er2Lr1cduSVFkwRW9NiGrzbdqNU8T 02foPsk72LDGqAl4PIO2pncrbS7f97227PTw6LfDLtNdCgvgmCM/RRPiTRKXxeWd iKVrgNE6b1iUFB1u2Z511ec5ZQmx1kaC1mwI1ZMOPiDjxt+z2Jh/Qb9Rg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeggddvjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeg geffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 30 Sep 2023 19:48:19 -0400 (EDT) Date: Sun, 1 Oct 2023 08:48:10 +0900 From: Michael Paquier To: Japin Li Cc: amutu@amutu.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18134: ROW_COUNT do not set to 0 when psql's \gset command get no rows returned Message-ID: References: <18134-87126d90cb4dd049@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="8vp5FtPkOU1eK5DW" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --8vp5FtPkOU1eK5DW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Sep 27, 2023 at 06:00:58PM +0800, Japin Li wrote: > It seems SaveResultVariables() was lost when executing failed. Attached fix it. Yeah, I think that you're right here, the variables should be set. SetResultVariables() ought to be called even if \gset failed to return a result. We have a bunch of paths in the psql code (for backend errors as well as errors internal to psql) where things are done this way, and the top of SetResultVariables() even documents that. -- Michael --8vp5FtPkOU1eK5DW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmUYs7oACgkQnvQgOdby QH3i7A/9FYyHbU9vHkN+DcZCSF0Ib+rbFZnfyRTpEbKFGPjDRxGFAoJSRj6WPHY2 iK8fsI+DDosy2zlHwSpV8nEp+FXZ2Ga6GlBLWHhx4rzoc6qusF/nMLiBb6ufz8B6 CU0DJyBDrYlWjGn0Hn5eMxUqfLkvM3wz4gL5z4IvRepirFjnAaGhjyNKdsRjZude JkJoynOCPOdep4HTXCy+AxMr1R28Ap3TyoX/QOxT7kMCun8ESxkMLi0sLzj7Tkt0 g97Y04jD7mwdR0qiGUMN3fJL7b4BiKFkWo/g6xCAaoHMkST9ns3X/H0DFGgq+ANn PDE2papYFzCm5ky7gK+lwK42piL/qe553GdtPZWEE1yiU9tE6mwMI+DzjDK0AmTy eppwkqIEl06tDCQx1xZqhAwKcd9Zu0ouK1+kk1G+vSAjlgPqkmippICcbxB+/N02 tPafy1mqeKY3ioeOQu4c8u9iVm5AYleXAn8+Bcr34lRtuvBma5IMZyGgQRbkPLtU 0W0j7r70Qg/4BsipjO78zBavydyHR7j0mv8oVlXdklJz2YXsDWG6bw4bKn8Y2E3N AyDIckdjXFrrzy2AT/qtyqx5+6S4oJ3oTVqdRTThuM510ev2na20Jh3DY8qSCKCj 9eED3i8BdOH2ZxSblxXp5oChtkwlyqhHsFqQy8uo0F8ns7P9l3E= =SMtb -----END PGP SIGNATURE----- --8vp5FtPkOU1eK5DW--