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

No longer able to retrieve enum array in v1.9.0 using pgx #1126

Closed
rhodee opened this issue Aug 15, 2021 · 5 comments
Closed

No longer able to retrieve enum array in v1.9.0 using pgx #1126

rhodee opened this issue Aug 15, 2021 · 5 comments

Comments

@rhodee
Copy link

rhodee commented Aug 15, 2021

Prior to 1.9.0 sqlc was able to return an ([]interface{}, error) for the following kind of query:

My code sets up the following query:

-- name: LotAltitude :many
SELECT unnest(enum_range(null::lot_altitude_designation))

I get the following error:

can't scan into dest[0]: unknown oid 20450 cannot be scanned into *interface {}

So I did some research and found the RegisterDataType method. This however has raised more questions of how to provide the pointer value to satisfy the pgtype.Value.

When I revert to 1.6.0 the issue is no longer present. Is there any guidance you can provide for getting unblocked?

Awesome work team and I appreciate you helping me level up my pgx knowledge -

@kyleconroy
Copy link
Collaborator

How are you using pgx with 1.6.0? Official support just landed in the latest release

@rhodee
Copy link
Author

rhodee commented Aug 15, 2021

Hi @kyleconroy apologies. I was using version 1.6.0 (no pgx) and just tried upgrade.

My go.mod with v1.9.0 contains these entries:

github.com/jackc/pgconn v1.10.0
github.com/jackc/pgx/v4 v4.13.0

@kyleconroy
Copy link
Collaborator

kyleconroy commented Aug 16, 2021

Can you include a code sample that shows how you're using sqlc 1.6.0 with pgx? It wasn't supported before, so I'm not sure how it was working.

@kyleconroy kyleconroy added the question Further information is requested label Aug 16, 2021
@rhodee
Copy link
Author

rhodee commented Aug 16, 2021

Hi @kyleconroy - let me restate the problem.

Starting with sqlc v1.9.0 I am not longer able to return an enumerated list. I have created two repos that return two different results based on the driver, although the SQL is identical.

In summary:

  1. In all previous sqlc versions (using the config and query in enum_array_sqldb) returned values.
  2. When moving to pgx_v4 as the sql_package no values are returned.

Repos:

https://github.com/rhodee/enum_array_pgxv4
https://github.com/rhodee/enum_array_sqldb

Thank you for your patience.

@kyleconroy kyleconroy added bug Something isn't working 🔧 golang and removed question Further information is requested labels Aug 16, 2021
@kyleconroy
Copy link
Collaborator

@rhodee Those repositories are sadly 404ing for me. If you're still having issues, cold you try using the latest version of sqlc (1.17.2) with pgx/v5? If things are still broken, please open up a new issues with a complete repro and a link to play.sqlc.dev.

@kyleconroy kyleconroy closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants