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

Fix handling of unknown column types #6540

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Fix handling of unknown column types #6540

merged 1 commit into from
Apr 26, 2024

Conversation

looi
Copy link
Contributor

@looi looi commented Aug 23, 2023

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

When using the go clickhouse driver, scanning into sql.RawBytes is not supported for most columns. I think the database/sql standard only guarantees that all columns can be converted to *interface{}, not RawBytes, so gorm should not make this assumption.

This issue doesn't affect most drivers like sqlite, mysql, postgres, but it does affect clickhouse. The following test will pass once this change is merged: go-gorm/clickhouse#128

User Case Description

@jinzhu
Copy link
Member

jinzhu commented Oct 10, 2023

This might broken query with maps?

If it is possible to make the clickhouse driver support sql.RawBytes, I think this might be a better solution?

@looi
Copy link
Contributor Author

looi commented Oct 20, 2023

Why should it break maps? I think any driver would be happy to scan a map into interface{}?

I don't think changing the clickhouse driver is the right solution because the clickhouse driver isn't violating the spec. Even if the clickhouse driver is changed, gorm may still be broken with other compliant drivers.

@jinzhu jinzhu merged commit 9d370bc into go-gorm:master Apr 26, 2024
24 checks passed
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 this pull request may close these issues.

2 participants