diff options
author | drh <> | 2024-02-19 16:22:58 +0000 |
---|---|---|
committer | drh <> | 2024-02-19 16:22:58 +0000 |
commit | e7bdb2172c717f7ba64e15fb65b930524e759d71 (patch) | |
tree | 4df3b8b0a318608261e4f2f2ec8ae120d7508e59 /src/btree.c | |
parent | 6c6356f7f2f3c6e717d445d117407e2edecccac5 (diff) | |
download | sqlite-e7bdb2172c717f7ba64e15fb65b930524e759d71.tar.gz sqlite-e7bdb2172c717f7ba64e15fb65b930524e759d71.zip |
If a table has one or more rows and it has a partial index has zero rows,
still make an entry in the sqlite_stat1 table for the partial index, so that
we know that "PRAGMA optimize" does not need to redo the whole table.
FossilOrigin-Name: e147b18991dd462fff367442acb0504fdf193a31843ed34ec8c1ced30747bf8a
Diffstat (limited to 'src/btree.c')
-rw-r--r-- | src/btree.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/btree.c b/src/btree.c index 49c07c81a..16b683abe 100644 --- a/src/btree.c +++ b/src/btree.c @@ -6182,10 +6182,10 @@ i64 sqlite3BtreeRowCountEst(BtCursor *pCur){ assert( cursorOwnsBtShared(pCur) ); assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); - /* Currently this interface is only called by the OP_IfSmaller - ** opcode, and it that case the cursor will always be valid and - ** will always point to a leaf node. */ - if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1; + /* Currently this interface is only called by the OP_IfSizeBetween + ** opcode and the OP_Count opcode with P3=1. In either case, + ** the cursor will always be valid unless the btree is empty. */ + if( pCur->eState!=CURSOR_VALID ) return 0; if( NEVER(pCur->pPage->leaf==0) ) return -1; n = pCur->pPage->nCell; |