SQLite User Forum

A testcase causing Assertion `pRoot->pgno==pCur->pgnoRoot' failed
Login

A testcase causing Assertion `pRoot->pgno==pCur->pgnoRoot' failed

(1) By Jingzhou Fu (fuboat) on 2022-03-07 14:15:48 [source]

System Information:

compile-time options: CC=clang-12 ./configure --enable-debug
sqlite_source_id: 2022-03-07 01:29:36 0057bbb508e7662b0da19e981c07ef10236cb616bda952745de3aa2d1c286289
output: sqlite3: sqlite3.c:71557: moveToRoot: Assertion `pRoot->pgno==pCur->pgnoRoot' failed.

PoC:

PRAGMA page_size = 1024;
PRAGMA auto_vacuum = 1;
CREATE TABLE t1(x);
WITH s(i) AS (
    SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<500
  )
  INSERT INTO t1 SELECT zeroblob(300) FROM s;
CREATE TABLE t2(y);
PRAGMA writable_schema = ON;
UPDATE sqlite_schema SET rootpage = 137 WHERE name='t2';
PRAGMA writable_schema = RESET;
PRAGMA writable_schema = 1;
PRAGMA max_page_count = 2 ;
PRAGMA journal_mode = off;
VACUUM;
PRAGMA schema_version = 0;
SAVEPOINT sp1;
DROP TABLE t1;
END;
VACUUM;

(2) By Richard Hipp (drh) on 2022-03-07 18:39:49 in reply to 1 [link] [source]

Seems to be harmless. The solution (check-in ae464a18d74bf44f) is to disable the offending assert().