SQLite User Forum

Assertion failure in sqlite3ExprAffinity function (2)
Login

Assertion failure in sqlite3ExprAffinity function (2)

(1) By Song Liu (songliu) on 2023-04-13 14:40:07 [source]

I found an assertion failure while SQLite (latest, eb94ae13206762a4) executes the following queries.

CREATE TABLE v0 (c1);
CREATE TABLE v1 (c);
CREATE TRIGGER t INSERT ON v0 BEGIN UPDATE v1 SET (c, c1)=(SELECT 0) FROM v0 JOIN v1 ON (SELECT 0 FROM (SELECT c1)); END;
ALTER TABLE v0 RENAME COLUMN c1 TO c;

Here are the outputs:

sqlite3: sqlite3.c:106174: sqlite3ExprAffinity: Assertion `pExpr->iTable==pExpr->pLeft->x.pSelect->pEList->nExpr' failed.
[2]    1115763 abort      ./sqlite3 < poc

Here is the result of bisecting:

 10 BAD     2022-05-27 15:04:43 53fbc269ddbabc4a                          
 12 GOOD    2022-05-27 14:41:48 f56473f9cc1b476b CURRENT  

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"