ClickHouse / ClickHouse/clickhouse-go

Null* isn't compatible with std interface

Open
#754 12 comments 5 reactions 1 assignee Claimed by @gingerwizard View on GitHub
bug docs help wanted
Dominant language
Go
Stars
3.3k
Forks
680
Avg merge
2d 3h
Merged PRs (30d)
14

Description

### Issue description
Unable to read Rows from a Table that has Null Values anywhere using the 'database/sql' interface. Even though 'sql.Nullstring' is being used. Expected to be able scan into a slice of 'sql.Nulstring' but instead get an error.

### Example code
```
for rows.Next() {
columns := make([]sql.NullString, len(cols))
columnPointers := make([]interface{}, len(cols))
for i := range columns {
columnPointers[i] = &columns[i]
}
err = rows.Scan(columnPointers...)
// Error occured while scanning a row
if err != nil {
fmt.Println()
fmt.Println(err) ̑
fmt.Println()
}
```
image

### Error log
```
sql: Scan error on column index 0, name "col1": unsupported Scan, storing driver.Value type *string into type *string

```
image

### Configuration
*OS:* Ubuntu 20.04.4 LTS

*Interface:* `database/sql`

*Driver version:* v2.3.0

*Go version:* go version go1.18.2 linux/amd64

*ClickHouse Server version:* version 22.9.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.