Skip to content

Commit f642dd5

Browse files
DuckDB: Allow quoted date parts in EXTRACT (#2030)
1 parent 7021561 commit f642dd5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/dialect/duckdb.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ impl Dialect for DuckDbDialect {
7070
true
7171
}
7272

73+
/// Returns true if this dialect allows the `EXTRACT` function to use single quotes in the part being extracted.
74+
fn allow_extract_single_quotes(&self) -> bool {
75+
true
76+
}
77+
7378
// DuckDB is compatible with PostgreSQL syntax for this statement,
7479
// although not all features may be implemented.
7580
fn supports_explain_with_utility_options(&self) -> bool {

tests/sqlparser_duckdb.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,3 +869,9 @@ fn test_duckdb_trim() {
869869
duckdb().parse_sql_statements(error_sql).unwrap_err()
870870
);
871871
}
872+
873+
#[test]
874+
fn parse_extract_single_quotes() {
875+
let sql = "SELECT EXTRACT('month' FROM my_timestamp) FROM my_table";
876+
duckdb().verified_stmt(sql);
877+
}

0 commit comments

Comments
 (0)