Re: ERROR: found unexpected null value in index - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: ERROR: found unexpected null value in index
Date
Msg-id CAH2-Wz=+N+QZ=+ACv3PQ8LqXmsMbfuMviGTYg7X5rwE6xT2L=Q@mail.gmail.com
Whole thread Raw
In response to Re: ERROR: found unexpected null value in index  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ERROR: found unexpected null value in index
List pgsql-bugs
On Tue, Jul 9, 2019 at 6:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I just finished doing that, and indeed it fingers 3ca930fc3 as the
> first bad commit.  Seems like it must have exposed a pre-existing
> problem though?

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.

-- 
Peter Geoghegan



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: ERROR: found unexpected null value in index
Next
From: Tom Lane
Date:
Subject: Re: ERROR: found unexpected null value in index