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 1hl2dX-0004Pl-8B for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jul 2019 02:47:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hl2dU-0004to-GW for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jul 2019 02:47:12 +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 1hl2dU-0004t7-85 for pgsql-bugs@lists.postgresql.org; Wed, 10 Jul 2019 02:47:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hl2dO-0006NR-1x for pgsql-bugs@lists.postgresql.org; Wed, 10 Jul 2019 02:47:11 +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 x6A2l1oc008252; Tue, 9 Jul 2019 22:47:01 -0400 From: Tom Lane To: Peter Geoghegan cc: 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> Comments: In-reply-to Peter Geoghegan message dated "Tue, 09 Jul 2019 19:36:17 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8250.1562726821.1@sss.pgh.pa.us> Date: Tue, 09 Jul 2019 22:47:01 -0400 Message-ID: <8251.1562726821@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Geoghegan writes: > I think that the issue is related to a broken HOT chain -- the index > doesn't even have any NULL key values, since the CREATE INDEX came > after the INSERT that added a NULL value. However, it does have a > tuple with the key value 'a' that points to the root of a HOT chain > whose first value for the indexed attribute is NULL. The successor > tuple's value for the indexed attribute is 'a', as expected (of > course, this is a normal state that > IndexBuildHeapScan()/heapam_index_build_range_scan() expect other code > to deal with). > Back when get_actual_variable_range() used a dirty snapshot, it would > have not seen any NULL value with this test case, because the root of > the HOT chain would be considered recently dead. Hm. So maybe we need to teach it to ignore tuples that are not the tips of their HOT chains? regards, tom lane