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/05 14:35:31 UTC

(datafusion-sqlparser-rs) branch upstream/sqlite-postfix-colon updated (4c16affc -> b95f1b44)

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

LucaCappelletti94 pushed a change to branch upstream/sqlite-postfix-colon
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git


 discard 4c16affc SQLite: Trim test comments for colon-traversal rejection
 discard de5c5e8e SQLite: Reject colon-based semi-structured data traversal
     new b95f1b44 SQLite: Reject colon-based semi-structured data traversal

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (4c16affc)
            \
             N -- N -- N   refs/heads/upstream/sqlite-postfix-colon (b95f1b44)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


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


(datafusion-sqlparser-rs) 01/01: SQLite: Reject colon-based semi-structured data traversal

Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b95f1b442b378f9f50fbdad4f65efb02f1035045
Author: LucaCappelletti94 <ca...@gmail.com>
AuthorDate: Mon Oct 5 16:35:24 2026 +0200

    SQLite: Reject colon-based semi-structured data traversal
---
 src/dialect/sqlite.rs     |  9 +++++++++
 tests/sqlparser_sqlite.rs | 19 +++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/src/dialect/sqlite.rs b/src/dialect/sqlite.rs
index 6f9ec0d2..a01ced32 100644
--- a/src/dialect/sqlite.rs
+++ b/src/dialect/sqlite.rs
@@ -23,6 +23,7 @@ use crate::ast::{Expr, Statement};
 use crate::dialect::Dialect;
 use crate::keywords::Keyword;
 use crate::parser::{Parser, ParserError};
+use crate::tokenizer::Token;
 
 /// A [`Dialect`] for [SQLite](https://www.sqlite.org)
 ///
@@ -97,6 +98,14 @@ impl Dialect for SQLiteDialect {
         None
     }
 
+    fn get_next_precedence(&self, parser: &Parser) -> Option<Result<u8, ParserError>> {
+        match &parser.peek_token_ref().token {
+            // lowest prec to prevent it from turning into a binary op
+            Token::Colon => Some(Ok(self.prec_unknown())),
+            _ => None,
+        }
+    }
+
     fn supports_in_empty_list(&self) -> bool {
         true
     }
diff --git a/tests/sqlparser_sqlite.rs b/tests/sqlparser_sqlite.rs
index b8fad7e9..9c332c36 100644
--- a/tests/sqlparser_sqlite.rs
+++ b/tests/sqlparser_sqlite.rs
@@ -1024,6 +1024,25 @@ fn parse_n_prefix_not_national_string() {
     all_dialects_where(|d| d.supports_national_string_literal()).verified_stmt("SELECT N'hello'");
 }
 
+#[test]
+fn parse_colon_does_not_start_json_access() {
+    // SQLite rejects `SELECT c:se` (`near ":se": syntax error`); no `:` traversal.
+    assert!(sqlite().parse_sql_statements("SELECT c:se").is_err());
+    assert!(sqlite().parse_sql_statements("SELECT a:b FROM t").is_err());
+
+    let ast = sqlite().verified_only_select("SELECT :xxx");
+    assert_eq!(
+        ast.projection[0],
+        UnnamedExpr(Expr::Value(
+            (Value::Placeholder(":xxx".into())).with_empty_span()
+        )),
+    );
+
+    assert!(TestedDialects::new(vec![Box::new(GenericDialect {})])
+        .parse_sql_statements("SELECT a:b FROM t")
+        .is_ok());
+}
+
 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