Skip to content

Escape Date Literal {d 'YYYY-MM-DD'} Causes SQL Parser Error #173

@willshen99

Description

@willshen99

I'm using duckdb ODBC driver with SAS. SAS automatically generated ODBC escape date literal format {d 'YYYY-MM-DD'}, and DuckDB throws a parser error:

ERROR: CLI prepare error: ODBC_DuckDB->duckdb->PrepareStmt Parser Error: syntax error at or near "'2024-01-01'"  LINE 1: ...", "encounterid"  FROM
DIAGNOSIS  WHERE  ( "admit_date" >= {d '2024-01-01' } )                                                                      ^
SQL statement: SELECT  "admit_date", "encounterid" FROM DIAGNOSIS  WHERE  ( "admit_date" >= {d
'2024-01-01' } ).

Does DuckDB recognize date literal {d 'YYYY-MM-DD'}, or is there any option in the driver to translate it to DATE 'YYYY-MM-DD'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions