From 8d4ed110c0147d1a3f7b05bc65f493ca86fddebe Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Wed, 18 Jun 2025 08:19:04 +0300 Subject: [PATCH] alloc page1 on first tx (read OR write) - otherwise e.g. select * from sqlite_schema panics --- core/storage/pager.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/storage/pager.rs b/core/storage/pager.rs index dc1b92d7b..c982acb7c 100644 --- a/core/storage/pager.rs +++ b/core/storage/pager.rs @@ -602,12 +602,16 @@ impl Pager { #[inline(always)] pub fn begin_read_tx(&self) -> Result { + // We allocate the first page lazily in the first transaction + if self.is_empty.load(Ordering::SeqCst) { + self.allocate_page1()?; + } self.wal.borrow_mut().begin_read_tx() } #[inline(always)] pub fn begin_write_tx(&self) -> Result { - // We allocate the first page lazily in the *first* write transaction + // We allocate the first page lazily in the first transaction if self.is_empty.load(Ordering::SeqCst) { self.allocate_page1()?; }