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 1hsxh8-0001FB-3C for pgsql-bugs@arkaria.postgresql.org; Wed, 31 Jul 2019 23:07:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hsxh6-0007QI-UL for pgsql-bugs@arkaria.postgresql.org; Wed, 31 Jul 2019 23:07:40 +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 1hsxh6-0007JX-He for pgsql-bugs@lists.postgresql.org; Wed, 31 Jul 2019 23:07:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hsxh1-00071l-Nb for pgsql-bugs@lists.postgresql.org; Wed, 31 Jul 2019 23:07:39 +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 x6VN7TkP028808; Wed, 31 Jul 2019 19:07:29 -0400 From: Tom Lane To: Andres Freund cc: yi huang , pgsql-bugs@lists.postgresql.org Subject: Re: PostgreSQL12 crash bug report In-reply-to: <20811.1564344681@sss.pgh.pa.us> References: <20811.1564344681@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 28 Jul 2019 16:11:21 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28806.1564614449.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 31 Jul 2019 19:07:29 -0400 Message-ID: <28807.1564614449@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > yi huang writes: >> [ crashes with ] >> $ pgbench -h 127.0.0.1 -p 5432 -U exchange exchange -T 2 -c 4 -f /tmp/t= est.sql > As per the stack trace, we're trying to build a new tuple for the output > of a ValuesScan node, but the targetlist for that seems completely insan= e: After digging through this, it seems clear that it's the fault of ad0bda5d2, specifically this code in EvalPlanQualSlot: *slot =3D ExecAllocTableSlot(&epqstate->estate->es_tupleTable, epqstate->origslot->tts_tupleDescri= ptor, &TTSOpsVirtual); It's setting up an es_epqTupleSlot[] entry on the assumption that it should have the same tupdesc as the output tuple that's to be rechecked. This might accidentally fail to malfunction in single-table cases, but it's quite broken for any join case --- in particular, for the given test case, the scan tuple for the VALUES node surely doesn't have the same tupdesc as the join result. I think we need to change the API of EvalPlanQualSlot, because it cannot determine the correct tupdesc when it's not handed a Relation. I'm not entirely sure that its immediate callers can either :-( so this might propagate out a ways. Or perhaps we should move the slot-making someplace else. I'll go make an open item for this. regards, tom lane