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

Database/SQL API missing Precision for type DateTime64 #1462

Open
6 of 9 tasks
tientt-holistics opened this issue Dec 30, 2024 · 0 comments · May be fixed by #1469
Open
6 of 9 tasks

Database/SQL API missing Precision for type DateTime64 #1462

tientt-holistics opened this issue Dec 30, 2024 · 0 comments · May be fixed by #1469
Labels

Comments

@tientt-holistics
Copy link

tientt-holistics commented Dec 30, 2024

Observed

According to Clickhouse documentation, type Datetime64 has a tick size precision DateTime64(precision, [timezone]).
However, the returned type does not have precision.

Expected behaviour

DateTime64 type should have precision.

Code example

conn := clickhouse.OpenDB(&clickhouse.Options{
  Addr: []string{"127.0.0.1:9000"},
  Auth: clickhouse.Auth{
	  Database: "",
	  Username: "",
	  Password: "",
  },
})
rows, err := conn.Query(`SELECT toDateTime64(1546300800.123, 3)`)
columnTypes, _ := rows.ColumnTypes()

for _, columnType := range columnTypes {
   precision, scale, ok := columnType.DecimalSize();
   fmt.Printf("%d %d %t",precision, scale, ok) // returns 0, 0, false
}

Details

Environment

  • clickhouse-go version: v2.30.0
  • Interface: ClickHouse API / database/sql compatible driver
  • Go version: 1.23.4
  • Operating system: Ubuntu 22.04.5 LTS
  • ClickHouse version: 24.1.5.6
  • Is it a ClickHouse Cloud?: No
  • ClickHouse Server non-default settings, if any:
  • CREATE TABLE statements for tables involved:
  • Sample data for all these tables, use clickhouse-obfuscator if necessary
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.

2 participants