diff --git a/core/vdbe/execute.rs b/core/vdbe/execute.rs index 928f7f94a..18f3ecf4f 100644 --- a/core/vdbe/execute.rs +++ b/core/vdbe/execute.rs @@ -4229,13 +4229,8 @@ pub fn op_page_count( // TODO: implement temp databases todo!("temp databases not implemented yet"); } - // SQLite returns "0" on an empty database, and 2 on the first insertion, - // so we'll mimic that behavior. - let mut pages = pager.db_header.lock().database_size.into(); - if pages == 1 { - pages = 0; - } - state.registers[*dest] = Register::OwnedValue(OwnedValue::Integer(pages)); + let count = pager.db_header.lock().database_size.into(); + state.registers[*dest] = Register::OwnedValue(OwnedValue::Integer(count)); state.pc += 1; Ok(InsnFunctionStepResult::Step) } diff --git a/testing/pragma.test b/testing/pragma.test index c478c032c..29a460c65 100755 --- a/testing/pragma.test +++ b/testing/pragma.test @@ -35,7 +35,7 @@ do_execsql_test pragma-table-info-invalid-table { do_execsql_test_on_specific_db ":memory:" pragma-page-count-empty { PRAGMA page_count -} {0} +} {1} do_execsql_test_on_specific_db ":memory:" pragma-page-count-table { CREATE TABLE foo(bar);