You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/10/18 10:06:47 UTC
(datafusion-sqlparser-rs) branch gh-readonly-queue/main/pr-2658-63015f54ea69e1b06219c5b7268ef05461b850e1 created (now 4ad878405)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-2658-63015f54ea69e1b06219c5b7268ef05461b850e1
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
at 4ad878405 SQLite: Support a parenthesized table name in `FROM` (#2658)
This branch includes the following new commits:
new 4ad878405 SQLite: Support a parenthesized table name in `FROM` (#2658)
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.
---------------------------------------------------------------------
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: Support a parenthesized table name in `FROM` (#2658)
Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-2658-63015f54ea69e1b06219c5b7268ef05461b850e1
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
commit 4ad878405805b0a0c0df347acd91845c4745cff5
Author: Luca Cappelletti <ca...@gmail.com>
AuthorDate: Sun Oct 18 10:06:32 2026 +0000
SQLite: Support a parenthesized table name in `FROM` (#2658)
---
src/dialect/mod.rs | 3 ++-
src/dialect/sqlite.rs | 4 ++++
tests/sqlparser_sqlite.rs | 25 +++++++++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/dialect/mod.rs b/src/dialect/mod.rs
index f7c54a9b7..5997d7d30 100644
--- a/src/dialect/mod.rs
+++ b/src/dialect/mod.rs
@@ -1199,7 +1199,8 @@ pub trait Dialect: Debug + Any {
/// SELECT * FROM (mytable) AS alias;
/// ```
///
- /// [Snowflake](https://docs.snowflake.com/en/sql-reference/constructs/from)
+ /// [Snowflake](https://docs.snowflake.com/en/sql-reference/constructs/from),
+ /// [SQLite](https://www.sqlite.org/syntax/table-or-subquery.html)
fn supports_parens_around_table_factor(&self) -> bool {
false
}
diff --git a/src/dialect/sqlite.rs b/src/dialect/sqlite.rs
index 497639556..f63e4cbe1 100644
--- a/src/dialect/sqlite.rs
+++ b/src/dialect/sqlite.rs
@@ -142,4 +142,8 @@ impl Dialect for SQLiteDialect {
fn supports_national_string_literal(&self) -> bool {
false
}
+
+ fn supports_parens_around_table_factor(&self) -> bool {
+ true
+ }
}
diff --git a/tests/sqlparser_sqlite.rs b/tests/sqlparser_sqlite.rs
index ade2d9d82..2e60c75ef 100644
--- a/tests/sqlparser_sqlite.rs
+++ b/tests/sqlparser_sqlite.rs
@@ -1117,6 +1117,31 @@ fn parse_create_table_options_list() {
}
}
+#[test]
+fn parse_parenthesized_table_factor() {
+ for (sql, canonical) in [
+ ("SELECT * FROM (t)", "SELECT * FROM t"),
+ ("SELECT * FROM ((t))", "SELECT * FROM t"),
+ ("SELECT * FROM (t) AS a", "SELECT * FROM t AS a"),
+ ("SELECT * FROM (t AS a)", "SELECT * FROM t AS a"),
+ (
+ "SELECT * FROM ((SELECT 1) AS s)",
+ "SELECT * FROM (SELECT 1) AS s",
+ ),
+ ("SELECT * FROM f(), (t)", "SELECT * FROM f(), t"),
+ ] {
+ sqlite_and_generic().one_statement_parses_to(sql, canonical);
+ }
+
+ assert_eq!(
+ all_dialects_where(|d| !d.supports_parens_around_table_factor())
+ .parse_sql_statements("SELECT * FROM (t)"),
+ Err(ParserError::ParserError(
+ "Expected: joined table, found: )".to_string()
+ ))
+ );
+}
+
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