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 riverdatabasesql nil values in bytea #739

Merged
merged 2 commits into from
Feb 2, 2025
Merged

Conversation

bgentry
Copy link
Contributor

@bgentry bgentry commented Feb 2, 2025

As #650 illustrates, the riverdatabasesql driver has issues with encoding arrays of byte arrays (bytea[]) and just byte arrays in general because the underlying pq implementation used by sqlc doesn't differentiate between nil vs empty slices. Fix this with a custom type.

The previously written test coverage (first commit) was failing, and gets fixed by this change.

Fixes #650.

@bgentry bgentry requested a review from brandur February 2, 2025 18:15
As #650 illustrates, the riverdatabasesql driver has issues with
encoding arrays of byte arrays (`bytea[]`) and just byte arrays in
general because the underlying pq implementation used by sqlc doesn't
differentiate between nil vs empty slices. Fix this with a custom type.

Fixes #650.
@bgentry bgentry force-pushed the bg-fix-dbsql-nil-bytea branch from a6f5502 to 547ac05 Compare February 2, 2025 18:17
@bgentry bgentry changed the title Fix dbsql nil bytea Fix riverdatabasesql nil values in bytea[] Feb 2, 2025
@bgentry bgentry changed the title Fix riverdatabasesql nil values in bytea[] Fix riverdatabasesql nil values in bytea Feb 2, 2025
Copy link
Contributor

@brandur brandur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one! Thx.

@bgentry bgentry merged commit 45c9332 into master Feb 2, 2025
10 checks passed
@bgentry bgentry deleted the bg-fix-dbsql-nil-bytea branch February 2, 2025 19:44
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.

riverdatabasesql driver inserts empty unique key arrays instead of null
2 participants