Merge 'string sometimes used as identifier quoting' from Lâm Hoàng Phúc

fix https://github.com/tursodatabase/turso/issues/2886#issuecomment-
3244885481

Closes #2894
This commit is contained in:
Pekka Enberg
2025-09-02 18:34:43 +03:00
committed by GitHub
2 changed files with 14 additions and 2 deletions

View File

@@ -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

View File

@@ -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}
} {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}