Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DuckDB STRFTIME arguments incorrectly ordered #3240

Closed
markhalonen opened this issue Mar 28, 2024 · 0 comments · Fixed by #3242
Closed

DuckDB STRFTIME arguments incorrectly ordered #3240

markhalonen opened this issue Mar 28, 2024 · 0 comments · Fixed by #3242

Comments

@markhalonen
Copy link

Fully reproducible code snippet

import sqlglot
print(sqlglot.transpile("""

select strftime('%Y-%m-%d', current_timestamp)


""", read="sqlite", write="duckdb", pretty=True)[0])

produces

SELECT
  STRFTIME('%Y-%m-%d', CURRENT_TIMESTAMP)

but that fails on DuckDB with

duckdb> SELECT
   ...>   STRFTIME('%Y-%m-%d', CURRENT_TIMESTAMP)
   ...> ;
Binder Error: No function matches the given name and argument types 'strftime(STRING_LITERAL, TIMESTAMP WITH TIME ZONE)'. You might need to add explicit type casts.
        Candidate functions:
        strftime(DATE, VARCHAR) -> VARCHAR
        strftime(TIMESTAMP, VARCHAR) -> VARCHAR
        strftime(VARCHAR, DATE) -> VARCHAR
        strftime(VARCHAR, TIMESTAMP) -> VARCHAR

LINE 2:   STRFTIME('%Y-%m-%d', CURRENT_TIMESTAMP)
          ^

duckdb> 

Official Documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant