From 635402fc6fb2430abf7934290e2cb1771cc29e62 Mon Sep 17 00:00:00 2001 From: TcMits Date: Tue, 2 Sep 2025 21:35:37 +0700 Subject: [PATCH] string sometimes used as identifier quoting --- core/util.rs | 7 ++++++- testing/create_table.test | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/util.rs b/core/util.rs index 0311c45e1..e38c08f5b 100644 --- a/core/util.rs +++ b/core/util.rs @@ -58,7 +58,12 @@ impl RoundToPrecision for f64 { } // https://sqlite.org/lang_keywords.html -const QUOTE_PAIRS: &[(char, char)] = &[('"', '"'), ('[', ']'), ('`', '`')]; +const QUOTE_PAIRS: &[(char, char)] = &[ + ('"', '"'), + ('[', ']'), + ('`', '`'), + ('\'', '\''), // string sometimes used as identifier quoting +]; pub fn normalize_ident(identifier: &str) -> String { let quote_pair = QUOTE_PAIRS diff --git a/testing/create_table.test b/testing/create_table.test index 1160922bd..c866378b9 100755 --- a/testing/create_table.test +++ b/testing/create_table.test @@ -20,4 +20,11 @@ do_execsql_test_on_specific_db {:memory:} create_table_rowid_unique_regression_t create table u(x integer unique primary key); insert into u values (1),(2),(3); select * from u where x > 2; -} {3} \ No newline at end of file +} {3} + +# https://github.com/tursodatabase/turso/issues/2886#issuecomment-3244885481 +do_execsql_test_on_specific_db {:memory:} create_table_with_empty_string_name { + create table ''('' INTEGER) strict; + insert into '' values(9); + select * from ''; +} {9}