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

error occured when bind time.Time query param #1016

Closed
suddenDisappear opened this issue Jun 28, 2023 · 1 comment · Fixed by #1260
Closed

error occured when bind time.Time query param #1016

suddenDisappear opened this issue Jun 28, 2023 · 1 comment · Fixed by #1260
Labels

Comments

@suddenDisappear
Copy link

bind time.Time to sql query param, an error occured.I found in v2.6.0 bind.go time.Time convert to toDateTime('%d') and which in v2.0.14 is toDateTime(%d).so I doublt is this change cause this error.

Expected behaviour

transfer time.Time to toDateTime(0), and not toDateTime('0')

Error log

Cannot parse datetime: Cannot parse DateTime from String: While processing SELECT id FROM my_table WHERE (created_at >= toDateTime('0')) AND (created_at <= toDateTime('1687859100'))"

Configuration

Environment

  • Client version:v2.6.0
  • Language version:1.18.6
  • OS:docker image 22.9.7.29-alpine
  • Interface: ClickHouse API / database/sql compatible driver

ClickHouse server

  • ClickHouse Server version:22.9.7.29
  • ClickHouse Server non-default settings, if any:
  • CREATE TABLE statements for tables involved:
  • Sample data for all these tables, use clickhouse-obfuscator if necessary
@suddenDisappear
Copy link
Author

I found out error occured when use toDateTime('0'),which is normal when use toDateTime(0) and like toDateTime('1651334400')

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

Successfully merging a pull request may close this issue.

1 participant