This similar test case, that I just found now, demonstrates that this could
be a pattern that is used in practice (TRUE can also be computed):

CREATE TABLE t0 (c0);
CREATE INDEX index_0 ON t0(c0) WHERE c0 NOTNULL;
INSERT INTO t0(c0) VALUES (NULL);
SELECT * FROM t0 WHERE (c0 OR TRUE);

Also here, the row is not fetched.

Best,
Manuel

On Sat, May 4, 2019 at 3:45 PM Manuel Rigger <rigger.man...@gmail.com>
wrote:

> Hi,
>
> I discovered a bug, which is demonstrated through the following test case:
>
> 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 (LIKELY(~c0) OR TRUE);
>
> No row is fetched, although the WHERE clause is always TRUE. I could
> reproduce this bug only when creating a partial index, and when using
> either LIKELY or UNLIKELY. The datatype of the c0 column seems to
> irrelevant. PRAGMA integrity_check; and REINDEX could not detect this error.
>
> Best,
> Manuel
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to