Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGEOD-0005ls-7o for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Oct 2019 03:36:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGEOC-00079q-1N for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Oct 2019 03:36:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGEOB-00079h-Pr for pgsql-bugs@lists.postgresql.org; Fri, 04 Oct 2019 03:36:19 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGEO8-0001bC-9C for pgsql-bugs@lists.postgresql.org; Fri, 04 Oct 2019 03:36:19 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 6628F6BF; Thu, 3 Oct 2019 23:36:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 03 Oct 2019 23:36:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=oQ5ahNBUSeKKeHneswqpCVLC4Nf n5ga/Qb7GOpHk030=; b=nJ+pqsixnFbAUuwtiPvM38+1wNXGD+EcTrOXCO7eAwX eylNnemG7NRq+DY8fAdzt7Tyq0V2uLxeFk0XmN6LjFxGhFeltkjyXaUQOM4s+skX Tprh4ILv9WTXkSpR7XzsFAT5eW79JKMCYCEkFBRGvdKWwfitmnSLuKmMGhhZp9Ss rXAUaJ0vsGtEcaAC0Ymhoud8F0bglRlVdNAx10OMtyQVVOjhrqaa2HctlmD/Mu3k J26LqZpIq69TOQxk8HGxoBQPmpVOjxX58ijHL2uC0FEaEgMyMyRg1hBkk7v7uDnj y9IMWviHWACxItrlJGmpp/D0C7OGsD+SsS1TtKGzYxg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=oQ5ahN BUSeKKeHneswqpCVLC4Nfn5ga/Qb7GOpHk030=; b=VXE6e7sYgrysugrVn/GHIa LIAgaXOoE2DJJfGP8TBoAm81QSgocVxVyDaR4YmlM8G7bo/oHUe8r7v45BUZ5bV8 iDKFy27EQqKbNZ7ZTUf4arMHNI4oBZ1qkUoh0AV5NZOizuwBJfWJWe8RAYWGvE/w f4Jq5F89lWwFrqWV9VMmbQlJnH258hzLfloVrbBsbn7o0SryanID64YffWrKXxoe hCxCROAM+0xfF1tegpNYgveDZcU+DOD4BmIuY1FxG9RyYxED7eBbCR1LZZUmKBBN LLi2iUKIF+mDeURUSQXasmgI8r4FLVh0Iy5PMwpgYr37DBbG6xgrCZH9RTvjuBQA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrhedtgddtjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehttdertd dttddvnecuhfhrohhmpeetnhgurhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgr rhgriigvlhdruggvqeenucfkphepieejrdduiedtrddvudekrddvfeejnecurfgrrhgrmh epmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrdguvgenucevlhhushht vghrufhiiigvpedt X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-218-237.hsd1.ca.comcast.net [67.160.218.237]) by mail.messagingengine.com (Postfix) with ESMTPA id E3DAAD60065; Thu, 3 Oct 2019 23:36:11 -0400 (EDT) Date: Thu, 3 Oct 2019 20:36:10 -0700 From: Andres Freund To: Tom Lane Cc: =?utf-8?B?0JDQvdGC0L7QvSDQktC70LDRgdC+0LI=?= , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16036: Segmentation fault while doing an update Message-ID: <20191004033610.fb47ehgycodogn6w@alap3.anarazel.de> References: <16036-28184c90d952fb7f@postgresql.org> <4E1FB33C-7280-487B-B3D1-D3C247AA9E3D@anarazel.de> <746398E3-F4E1-4F14-A686-3394F27011DC@gmail.com> <20191004032020.se46diwqas43e3tw@alap3.anarazel.de> <11540.1570159561@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11540.1570159561@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2019-10-03 23:26:01 -0400, Tom Lane wrote: > Andres Freund writes: > > So I think what we need to do is: > > 1) only call ExecCopySlot() if slot != newslot - this fixes the crash > > 2) Add an assert to ExecCopySlot() ensuring source and target slot are > > distinct > > 3) Figure out why our tests didn't catch this, this afaict should be a > > tested scenario > > 4) Fix confusing variable naming around newSlot/newslot in ExecBRUpdateTriggers > > Maybe instead of 1+2, change ExecCopySlot like this: > > - dstslot->tts_ops->copyslot(dstslot, srcslot); > + if (dstslot != srcslot) > + dstslot->tts_ops->copyslot(dstslot, srcslot); > > That would fix other similar instances, not just this one caller. Yea, I was wondering about that too - but asking for a slot to be copied into itself seems to indicate a logic bug more often than not? Expecting the slots to be independent, afterwards. So I'm a bit hesitant doing so. Greetings, Andres Freund