|Title:||Incorrect result on a table scan of a partial index|
|Last Modified:||2019-05-04 17:34:15|
|Version Found In:|
drh added on 2019-05-04 16:59:49:
The final SELECT statement in the following SQL returns no rows, but it should return a single row with a NULL value: <blockquote><verbatim> CREATE TABLE t0(c0); CREATE INDEX index_0 ON t0(c0) WHERE c0 NOT NULL; INSERT INTO t0(c0) VALUES (NULL); SELECT * FROM t0 WHERE c0 OR 1; </verbatim></blockquote> Bisecting this error lands on check-in [fe1874321ba31cec]. But I suspect that is just where the symptoms first appeared and that the problem is a deeper and older error in the theorem prover that (incorrectly) establishes that c0 is not null when "c0 OR 1" is true. This issue was discovered by Manuel Rigger and reported on the SQLite mailing list.
drh added on 2019-05-04 17:34:15: (text/x-fossil-wiki)
Confirmed: the error was in the theorem prover. The error goes all the way back to when partial index support was first added to SQLite in version 3.8.0 (2013-08-26). The problem is fixed by check-in [c2e439bccc40825e211bf] (2019-05-04).