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 1pSNfl-0004dV-HY for pgsql-bugs@arkaria.postgresql.org; Wed, 15 Feb 2023 19:42:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pSNfk-0006r9-9A for pgsql-bugs@arkaria.postgresql.org; Wed, 15 Feb 2023 19:42: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 1pSNfj-0006r0-BQ for pgsql-bugs@lists.postgresql.org; Wed, 15 Feb 2023 19:42:32 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSNfg-0005uB-J5 for pgsql-bugs@lists.postgresql.org; Wed, 15 Feb 2023 19:42:30 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id ABBAC5C017C; Wed, 15 Feb 2023 14:42:26 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 15 Feb 2023 14:42:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1676490146; x=1676576546; bh=z 1CuMhcTSkBz+rJhWZF/QQnqxGA1mJkXi0A87HNsHXI=; b=RhWqeamVAsdeZVDdO vDasgqB2x5PqM2qHKpLqojYYzDQBLxB0UsOjnKlzKtlgJFGqK/Pn/v9dCXKzSvo4 t5wR0Vdx41p096wlJ0hES/N7burZ5M7+UBAwyjH0WefDbZaWDPlgxDm2vzUp1JLs 7fKKKDmEq8OXeXIcDdydIpmvOKVPzNbRIQrBD01jlmVf8cECRLlxEYDmJ9fZd/vm Yhiptv5fcTqN2DP0vjOUaUahwXftT0DTyrVPPH1R5bHO3+0aaqgpyf+q4Gr6l8b5 8PZWjZaa809fsrLrFCqllvTB7Ovhoz7UMA7g/GYL5T1O9SlWczYnOwtbBMA/Eozf SJmVA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeihedguddvudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Feb 2023 14:42:26 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 3A5B29E; Wed, 15 Feb 2023 20:42:24 +0100 (CET) Date: Wed, 15 Feb 2023 20:42:24 +0100 From: Alvaro Herrera To: Dean Rasheed Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently Message-ID: <20230215194224.egfyt3j5ewy4c6m3@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 2023-Feb-15, Dean Rasheed wrote: > On Tue, 14 Feb 2023 at 19:19, Alvaro Herrera wrote: > > > > I agree, this looks to be a good fix. However, I couldn't in a quick > > try reproduce the problem, so I haven't been able to verify it. I'll > > try to do that early tomorrow. > > I did some more testing, and the fix looks good. Thank you, I have pushed it. > > (I also delete the XXX comment there.) > > That makes sense. It's a bit inconsistent (though not related to this > bug) that a cross-partition update will return OK if the tuple was > concurrently deleted, so merge will think that it updated the tuple > and not try an insert action, whereas for a normal update it will try > an insert action if the tuple was concurrently deleted. The thing that > seems wrong there is that ExecUpdateAct() sets updateCxt->updated = > true for a cross-partition update regardless of whether it actually > executed the insert half of the update/move. In theory, that flag > could be set to false so that merge would know if the tuple was > concurrently deleted, though it's not clear if it's worth it. Hmm. I wonder if this is just an inconsistency, or rather an outright bug. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/