This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
The following commit(s) were added to refs/heads/main by this push:
new f642dd57 DuckDB: Allow quoted date parts in EXTRACT (#2030)
f642dd57 is described below
commit f642dd573cbf700b8591eeb9e1f6bf3ed8f98659
Author: Ryan Schneider <[email protected]>
AuthorDate: Tue Sep 16 11:25:24 2025 -0700
DuckDB: Allow quoted date parts in EXTRACT (#2030)
---
src/dialect/duckdb.rs | 5 +++++
tests/sqlparser_duckdb.rs | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/src/dialect/duckdb.rs b/src/dialect/duckdb.rs
index 37cf7d36..f08d827b 100644
--- a/src/dialect/duckdb.rs
+++ b/src/dialect/duckdb.rs
@@ -70,6 +70,11 @@ impl Dialect for DuckDbDialect {
true
}
+ /// Returns true if this dialect allows the `EXTRACT` function to use
single quotes in the part being extracted.
+ fn allow_extract_single_quotes(&self) -> bool {
+ true
+ }
+
// DuckDB is compatible with PostgreSQL syntax for this statement,
// although not all features may be implemented.
fn supports_explain_with_utility_options(&self) -> bool {
diff --git a/tests/sqlparser_duckdb.rs b/tests/sqlparser_duckdb.rs
index 5bad7336..0f805195 100644
--- a/tests/sqlparser_duckdb.rs
+++ b/tests/sqlparser_duckdb.rs
@@ -869,3 +869,9 @@ fn test_duckdb_trim() {
duckdb().parse_sql_statements(error_sql).unwrap_err()
);
}
+
+#[test]
+fn parse_extract_single_quotes() {
+ let sql = "SELECT EXTRACT('month' FROM my_timestamp) FROM my_table";
+ duckdb().verified_stmt(sql);
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]