From f78bc1efe5256b97cbd66c306e2c7a5d6f3ec3e2 Mon Sep 17 00:00:00 2001 From: Anton Harniakou Date: Wed, 4 Jun 2025 18:12:54 +0300 Subject: [PATCH] Support sqlite_master schema table name --- core/schema.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/schema.rs b/core/schema.rs index 72a16e4c7..a30d59dcf 100644 --- a/core/schema.rs +++ b/core/schema.rs @@ -14,6 +14,9 @@ use std::rc::Rc; use std::sync::Arc; use tracing::trace; +const SCHEMA_TABLE_NAME: &str = "sqlite_schema"; +const SCHEMA_TABLE_NAME_ALT: &str = "sqlite_master"; + pub struct Schema { pub tables: HashMap>, // table_name to list of indexes for the table @@ -26,7 +29,7 @@ impl Schema { let indexes: HashMap>> = HashMap::new(); #[allow(clippy::arc_with_non_send_sync)] tables.insert( - "sqlite_schema".to_string(), + SCHEMA_TABLE_NAME.to_string(), Arc::new(Table::BTree(sqlite_schema_table().into())), ); Self { tables, indexes } @@ -51,7 +54,12 @@ impl Schema { pub fn get_table(&self, name: &str) -> Option> { let name = normalize_ident(name); - self.tables.get(&name).cloned() + let name = if name.eq_ignore_ascii_case(&SCHEMA_TABLE_NAME_ALT) { + SCHEMA_TABLE_NAME + } else { + &name + }; + self.tables.get(name).cloned() } pub fn remove_table(&mut self, table_name: &str) {