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

Add Scan to pgtype.FlatArray #1786

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

regeda
Copy link
Contributor

@regeda regeda commented Oct 31, 2023

Make pgtype.FlatArray respectful to sql.Scanner interface which makes sense when the standard sql package in use.

See #1779

@jackc
Copy link
Owner

jackc commented Nov 4, 2023

This seems to have broken a couple tests. Not immediately obvious why.

But even without that I'm not sure if this is the right approach. I would expect it to work with most of the built-in types, but not all. And if the user has customized their pgtype.Map it would mysteriously fail.

There's a fundamental issue that the with database/sql we don't have access to the type information from the database. And with a generic array type we don't have access to a specific Go type that we know corresponds to a specific PostgreSQL type.

I suspect that the solution will have to be in the stdlib package either as concrete types for each array type or a generic array type that requires the underlying type to have an additional method.

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