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 1kbzvw-0005fk-3P for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Nov 2020 05:41:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kbzvu-0000jv-Sb for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Nov 2020 05:41:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbzvu-0000jn-LS for pgsql-hackers@lists.postgresql.org; Mon, 09 Nov 2020 05:41:38 +0000 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbzvs-0006Fe-4U for pgsql-hackers@lists.postgresql.org; Mon, 09 Nov 2020 05:41:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1604900496; x=1636436496; h=to:references:from:message-id:date:mime-version: in-reply-to:content-transfer-encoding:subject; bh=3HNqT7CfwcGWKJgceFQRRLw2mrkO7X6DObhmP6T00Qo=; b=Z+Muy5tNX6Jq+FJRIPVFny2h/6u4NFam3X35RBWh7HHgZfVybR0gCrTg phsaepOjEez0WO+X6v2+ibdLq5DQS/93e3XRvPzP9YK1QIuh7jvb//3Ev BlY6s98+FjEG0TCNJVKFj3mTTjv5at8nYTV0sqHBNZwKbkamFq2NzKrmi s=; X-IronPort-AV: E=Sophos;i="5.77,462,1596499200"; d="scan'208";a="93115205" Subject: Re: [BUG]: segfault during update Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-6e2fc477.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 09 Nov 2020 05:41:28 +0000 Received: from EX13D03EUC003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2a-6e2fc477.us-west-2.amazon.com (Postfix) with ESMTPS id DFE3DA180B for ; Mon, 9 Nov 2020 05:41:27 +0000 (UTC) Received: from 38f9d36c4abb.ant.amazon.com (10.43.161.237) by EX13D03EUC003.ant.amazon.com (10.43.164.192) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 9 Nov 2020 05:41:24 +0000 To: References: <1831655.1604855899@sss.pgh.pa.us> <1832746.1604857604@sss.pgh.pa.us> From: "Drouvot, Bertrand" Message-ID: <3f67f014-743d-583b-8516-6286ec17ad05@amazon.com> Date: Mon, 9 Nov 2020 06:41:20 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 MIME-Version: 1.0 In-Reply-To: <1832746.1604857604@sss.pgh.pa.us> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.43.161.237] X-ClientProxiedBy: EX13D46UWB001.ant.amazon.com (10.43.161.16) To EX13D03EUC003.ant.amazon.com (10.43.164.192) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 11/8/20 6:46 PM, Tom Lane wrote: > I wrote: >> Yeah, this is sufficient reason why we must use the more invasive >> patch on those branches. What I'm wondering now is if there's a >> way to break even-older branches based on failure to handle dropped >> columns here. > After tracing through the example in v11, I see why those branches > are not broken: when ExecBRUpdateTriggers decides to return the > trigger-returned tuple, it sticks it into a target slot like this: > > /* > * Return the modified tuple using the es_trig_tuple_slot. We assume > * the tuple was allocated in per-tuple memory context, and therefore > * will go away by itself. The tuple table slot should not try to > * clear it. > */ > TupleTableSlot *newslot = estate->es_trig_tuple_slot; > TupleDesc tupdesc = RelationGetDescr(relinfo->ri_RelationDesc); > > if (newslot->tts_tupleDescriptor != tupdesc) > ExecSetSlotDescriptor(newslot, tupdesc); > ExecStoreTuple(newtuple, newslot, InvalidBuffer, false); > > So the slot that ExecConstraints et al will be working with contains > the relation's actual tuple descriptor, not the approximate descr > obtained by looking at the plan tlist. > > This logic is entirely gone in v12, which confirms my instinct that > there was something about Andres' slot-manipulation changes that > broke this scenario. In v12 we end up using the junkfilter's output > slot, which does not have a sufficiently accurate tupdesc to deal with > an on-disk tuple rather than one constructed by the executor. > > So I'll go see about back-patching 20d3fe900. Thanks for the back-patching! Bertrand