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

Queried Nullable values should be able to batch-insert similarly #777

Closed
mdonkers opened this issue Oct 5, 2022 · 0 comments · Fixed by #774
Closed

Queried Nullable values should be able to batch-insert similarly #777

mdonkers opened this issue Oct 5, 2022 · 0 comments · Fixed by #774

Comments

@mdonkers
Copy link
Contributor

mdonkers commented Oct 5, 2022

Issue description

When reading, a 'record' is initialized based on reflection, as is shown also in examples:

	record := make([]any, len(columnTypes), len(columnTypes)+recordExtraSpace)
	// Have to initialize 'empty' values to write actual values to
	for i := range columnTypes {
		record[i] = reflect.New(columnTypes[i].ScanType()).Interface()
	}

	rows.Scan(record...)

This will initialize Nullable columns such as Nullable(String) as double pointer **String type.

However when inserting this value in exactly the same format, this fails:

batch, err := c.conn.PrepareBatch(c.ctx, query)

batch.Append(record...)

Which will throw an error indicating **String cannot be inserted as Nullable(String)

Configuration

OS: Linux

Interface: Native

Driver version: 2.3.0

Go version: 1.19

ClickHouse Server version: 22.9+

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