Assertion failure in sqlite3ExprSkipCollateAndLikely function
(1) By Song Liu (songliu) on 2023-04-03 17:05:21 [link] [source]
I found an assertion failure while SQLite (latest, bcd51abee0b0f82b) executes the following queries.
CREATE TABLE v0 (T, c0);
CREATE INDEX i ON v0 (c0, +c0 COLLATE NOCASE);
SELECT 1 FROM v0 AS a0 WHERE (SELECT count(a0.c0 IS +a0.c0 COLLATE NOCASE IN (SELECT c0)) FROM v0 GROUP BY 10000000000) ORDER BY a0.c0;
Here are the outputs:
sqlite3: sqlite3.c:106157: sqlite3ExprSkipCollateAndLikely: Assertion `pExpr->op==TK_COLLATE' failed.
[1] 536319 abort ./sqlite3 < poc
Here is the result of bisecting:
11 BAD 2022-11-25 16:10:48 b9190d3da70c4171 CURRENT
10 GOOD 2022-11-25 15:52:00 1ad41840c5e0fa70
The assertion failure may be caused by the optimizations. SQLite crashes by default with all optimizations enabled. If I disable the SQLITE_IndexedExpr optimization, SQLite works well.
.testctrl optimizations 0x01000000;
My compilation flags:
export CFLAGS="-g -O0 -DSQLITE_DEBUG
-DSQLITE_ENABLE_TREETRACE
-DSQLITE_ENABLE_WHERETRACE
-DSQLITE_ENABLE_CURSOR_HINTS
-DSQLITE_COUNTOFVIEW_OPTIMIZATION
-DSQLITE_ENABLE_STAT4"
(2) By Song Liu (songliu) on 2023-04-03 18:02:45 in reply to 1 [source]
It seems the bug is fixed at commit cf6454ce26983b9c. Thanks for your work!