Hi, I'm seeing a very strange, consistently reproducible case, in which SQLITE_CORRUPT is being returned in response to a simple insert statement. There is only one connection to the db so it is unlikely a concurrency issue. The insert is immediately after the table is created. The table creation statement goes through successfully and if I look at the db file afterward with the sqlite explorer, the db and table look fine, but without inserted values, of course. This happens every time, in exactly the same way, which seems to rule out random corruption of the db file. I did a little debugging into the sqlite code and this is where the "corruption" is caught first:
static int pagerAcquire( Pager *pPager, /* The pager open on the database file */ Pgno pgno, /* Page number to fetch */ DbPage **ppPage, /* Write a pointer to the page here */ int noContent /* Do not bother reading content from disk if true */ ){ PgHdr *pPg; int rc; assert( pPager->state==PAGER_UNLOCK || pPager->nRef>0 || pgno==1 ); /* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page ** number greater than this, or zero, is requested. */ if( pgno>PAGER_MAX_PGNO || pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){ return SQLITE_CORRUPT_BKPT; <<<<<<<<<<<<<HERE } With some debug printfs I was able to see that pgno is -1 at this point! This is version sqlite v3.6.1 running on an embedded device. I'd appreciate any ideas as to how to debug this further. Thanks, -Albert _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users