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] Parsing DuckDB SQL will convert into illegal usage of CURRENT_TIMESTAMP, CURRENT_DATE #1550

Closed
BTheunissen opened this issue May 4, 2023 · 0 comments · Fixed by #1551

Comments

@BTheunissen
Copy link

It appears that CURRENT_TIMESTAMP/CURRENT_DATE will be transformed into CURRENT_TIMESTAMP()/CURRENT_DATE() which is illegal in DuckDB.

Fully reproducible code snippet

import sqlglot
import duckdb 

ts_sql = "SELECT CURRENT_TIMESTAMP"
date_sql = "SELECT CURRENT_DATE"

ts_res = sqlglot.parse_one(ts_sql, read="duckdb").sql()
date_res = sqlglot.parse_one(date_sql, read="duckdb").sql()

print(ts_res)
print(date_res)

duckdb.execute(ts_sql).fetchall() # Works
duckdb.execute(date_sql).fetchall() # Works
duckdb.execute(ts_res).fetchall() # Doesn't work `Parser Error: syntax error at or near ")"`
duckdb.execute(date_res).fetchall() # Doesn't work `Parser Error: syntax error at or near ")"`

Official Documentation
DuckDB current_date
current_timestamp appears to be missing a docs page.

@BTheunissen BTheunissen changed the title [DuckDB] Transpile converts into illegal usage of CURRENT_TIMESTAMP, CURRENT_DATE [DuckDB] Parsing DuckDB SQL will convert into illegal usage of CURRENT_TIMESTAMP, CURRENT_DATE May 4, 2023
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