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); +}