SQLite Forum

Unexpected Assertion Error in whereRangeScanEst
Login

Unexpected Assertion Error in whereRangeScanEst

(1) By Jinsheng Ba (bajinsheng) on 2022-06-24 01:29:56 [source]

Please see this assertion error:

CREATE TABLE t0 (c0);
CREATE TABLE t1 (c0);
CREATE TABLE t2 (c0 , c1 , c2 , UNIQUE (c0), UNIQUE (c2 DESC));
INSERT INTO t2 VALUES ('x', 'y', 'z');
ANALYZE;
CREATE VIEW v0(c0) AS SELECT FALSE;

SELECT * FROM t0 LEFT OUTER JOIN t1 ON v0.c0 INNER JOIN v0 INNER JOIN t2 ON (t2.c2 NOT NULL); -- sqlite3.c:155840: whereRangeScanEst: Assertion `pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0' failed.

Note that the assertion error manifests when STAT4 is enabled.

Environment:

Version: 3.39.0 (Unreleased)

Commit ID: 5fa00959

(2) By Richard Hipp (drh) on 2022-06-24 11:19:09 in reply to 1 [link] [source]

Thank you for the bug report.

The assertion fault appears to be harmless in this case. In other words, nothing bad happens (no memory errors or incorrect answers) in production builds that omit all assert() statements. Nevertheless, it is important to find and fix this kinds of things, which we have now done with check-in db5266dec601a951.

(3) By Jinsheng Ba (bajinsheng) on 2022-06-25 00:46:41 in reply to 2 [link] [source]

Thanks!