Re: ERROR: found unexpected null value in index

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: ERROR: found unexpected null value in index
Date: 2019-07-10 00:38:38
Message-ID: CAH2-Wzn-0MHr8Zquf5POJA+xYu0MVw_2Vh60BnE+0vQPgHv-AQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Jul 9, 2019 at 4:52 PM Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com> wrote:
> CREATE TABLE t0(c0 TEXT);
> INSERT INTO t0(c0) VALUES('b'), ('a');
> ANALYZE;
> INSERT INTO t0(c0) VALUES (NULL);
> UPDATE t0 SET c0 = 'a';
> CREATE INDEX i0 ON t0(c0);
> SELECT * FROM t0 WHERE 'baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
> > t0.c0; -- unexpected: ERROR: found unexpected null value in index
> "i0"
>
> The SELECT can result in "ERROR: found unexpected null value in index
> "i0"". I could reproduce this error only when some actions on other
> databases are performed. The error is rather difficult to reproduce,
> and small changes to the above statements cause it to no longer be
> reproducible on my machine.

The error comes from a point at which the planner accesses the index
before execution proper, within get_actual_variable_range(). Perhaps
commit 3ca930fc39c is to blame.

--
Peter Geoghegan

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Prakash Ramakrishnan 2019-07-10 00:50:44 Re: perl issue
Previous Message David Rowley 2019-07-10 00:38:26 Re: FDW does not push down LIMIT & ORDER BY with sharding (partitions)