Index: ext/misc/memstat.c ================================================================== --- ext/misc/memstat.c +++ ext/misc/memstat.c @@ -343,13 +343,15 @@ sqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ memstat_cursor *pCur = (memstat_cursor *)pVtabCursor; - pCur->iRowid = 1; + int rc = memstatFindSchemas(pCur); + if( rc ) return rc; + pCur->iRowid = 0; pCur->iDb = 0; - return memstatFindSchemas(pCur); + return memstatNext(pVtabCursor); } /* ** SQLite will invoke this method one or more times while planning a query ** that uses the memstat virtual table. This routine needs to create