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 1hlM1Z-0003Yx-Uo for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jul 2019 23:29:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlM1X-0003qp-My for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jul 2019 23:29:19 +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 1hlM1X-0003lu-Bw for pgsql-bugs@lists.postgresql.org; Wed, 10 Jul 2019 23:29:19 +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.89) (envelope-from ) id 1hlM1V-0000UO-5F for pgsql-bugs@lists.postgresql.org; Wed, 10 Jul 2019 23:29:18 +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 x6ANT6kv021235; Wed, 10 Jul 2019 19:29:06 -0400 From: Tom Lane To: Peter Geoghegan cc: Andres Freund , Manuel Rigger , PostgreSQL mailing lists Subject: Re: ERROR: found unexpected null value in index In-reply-to: References: <9288.1562720919@sss.pgh.pa.us> <20825.1562723034@sss.pgh.pa.us> <8251.1562726821@sss.pgh.pa.us> <12489.1562788970@sss.pgh.pa.us> <20190710201547.l6vs6y3cf2tuac73@alap3.anarazel.de> <13550.1562790349@sss.pgh.pa.us> <18788.1562797589@sss.pgh.pa.us> Comments: In-reply-to Peter Geoghegan message dated "Wed, 10 Jul 2019 16:08:42 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21233.1562801346.1@sss.pgh.pa.us> Date: Wed, 10 Jul 2019 19:29:06 -0400 Message-ID: <21234.1562801346@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Geoghegan writes: > On Wed, Jul 10, 2019 at 3:26 PM Tom Lane wrote: >> I was imagining it would still check the heap, if necessary, to verify >> that it'd found a tuple passing the given snapshot. > Not sure I follow. When or how would it not be necessary? Are you > merely referring to the simple case where the LP_DEAD bit is already > set for the item on the B-Tree leaf page? Index-only scans already have the LP_DEAD fast path (don't return value) and the all_visible fast path (always return value), and otherwise they do a heap visit. If we can use a custom visibility test in the heap visit and not muck up the opportunity to set LP_DEAD when relevant, then it seems like using the IOS code path will do exactly what we want. Otherwise some finagling might be necessary. But it still might be cleaner than directly looking at HOT-update status. I'll take a look at that tomorrow if nobody beats me to it. regards, tom lane