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 1iGEEM-0005Rt-8d for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Oct 2019 03:26:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGEEL-0003Go-42 for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Oct 2019 03:26:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGEEK-0003Gf-Pd for pgsql-bugs@lists.postgresql.org; Fri, 04 Oct 2019 03:26:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iGEEI-0005QI-G9 for pgsql-bugs@lists.postgresql.org; Fri, 04 Oct 2019 03:26:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x943Q1kE011541; Thu, 3 Oct 2019 23:26:01 -0400 From: Tom Lane To: Andres Freund cc: =?utf-8?B?0JDQvdGC0L7QvSDQktC70LDRgdC+0LI=?= , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16036: Segmentation fault while doing an update In-reply-to: <20191004032020.se46diwqas43e3tw@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> Comments: In-reply-to Andres Freund message dated "Thu, 03 Oct 2019 20:20:20 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11539.1570159561.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Oct 2019 23:26:01 -0400 Message-ID: <11540.1570159561@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > So I think what we need to do is: > 1) only call ExecCopySlot() if slot !=3D 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 ExecBRUpdateT= riggers Maybe instead of 1+2, change ExecCopySlot like this: - dstslot->tts_ops->copyslot(dstslot, srcslot); + if (dstslot !=3D srcslot) + dstslot->tts_ops->copyslot(dstslot, srcslot); That would fix other similar instances, not just this one caller. regards, tom lane