You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by lu...@apache.org on 2026/10/02 19:03:04 UTC

(datafusion-sqlparser-rs) 01/01: SQLite: Reject the DEL control character (U+007F) in unquoted identifiers

This is an automated email from the ASF dual-hosted git repository.

LucaCappelletti94 pushed a commit to branch upstream/sqlite-del-not-identifier
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git

commit a9226831386ab777198b3d9a335df92c32c59a2f
Author: LucaCappelletti94 <ca...@gmail.com>
AuthorDate: Fri Oct 2 21:02:51 2026 +0200

    SQLite: Reject the DEL control character (U+007F) in unquoted identifiers
---
 src/dialect/sqlite.rs     |  2 +-
 tests/sqlparser_sqlite.rs | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/dialect/sqlite.rs b/src/dialect/sqlite.rs
index 13bc555a..3cc0f1f9 100644
--- a/src/dialect/sqlite.rs
+++ b/src/dialect/sqlite.rs
@@ -51,7 +51,7 @@ impl Dialect for SQLiteDialect {
         ch.is_ascii_lowercase()
             || ch.is_ascii_uppercase()
             || ch == '_'
-            || ('\u{007f}'..='\u{ffff}').contains(&ch)
+            || ('\u{0080}'..='\u{ffff}').contains(&ch)
     }
 
     fn supports_filter_during_aggregation(&self) -> bool {
diff --git a/tests/sqlparser_sqlite.rs b/tests/sqlparser_sqlite.rs
index 81059761..22becadf 100644
--- a/tests/sqlparser_sqlite.rs
+++ b/tests/sqlparser_sqlite.rs
@@ -1011,6 +1011,23 @@ fn parse_n_prefix_not_national_string() {
     all_dialects_where(|d| d.supports_national_string_literal()).verified_stmt("SELECT N'hello'");
 }
 
+#[test]
+fn parse_del_not_identifier() {
+    // U+007F (DEL) is not a valid identifier character in SQLite, unquoted.
+    assert_eq!(
+        sqlite()
+            .parse_sql_statements("SELECT a\u{7f}b FROM t")
+            .unwrap_err(),
+        ParserError::ParserError("Expected: end of statement, found: \u{7f}".to_string())
+    );
+
+    // DEL stays valid inside a quoted identifier.
+    sqlite().verified_stmt("SELECT \"a\u{7f}b\" FROM t");
+
+    // Characters above U+007F remain valid, unquoted, as before.
+    sqlite().verified_stmt("SELECT a\u{80}b FROM t");
+}
+
 fn sqlite() -> TestedDialects {
     TestedDialects::new(vec![Box::new(SQLiteDialect {})])
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org