-
Notifications
You must be signed in to change notification settings - Fork 859
Add support for v5 of the pgx Go driver #1823
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
Comments
To support two version of pgx in the e2e tests at the same time we move 'pgx/v4' tests to the separated v4 directory. Then new 'pgx/v4' e2e tests will be located in the v5 dir.
* 'pgx/v5' option requires '--experimental' cli flag. * array, ranges, multiranges uses generic version for 'pgx/v5'. It supports multidemensional arrays. * 'pgx/v5' implementation prefers use pgtype types. For example, pgtype.Bool instead of sql.NullBool. * added support for new pg types: * datemultirange * tsmultirange * tstzmultirange * nummultirange * int4multirange * int8multirange * bit * varbit * cid * oid * tid * circle * line * lseg * path * point * polygon
* 'pgx/v5' option requires '--experimental' cli flag. * array, ranges, multiranges uses generic version for 'pgx/v5'. It supports multidemensional arrays. * 'pgx/v5' implementation prefers use pgtype types. For example, pgtype.Bool instead of sql.NullBool. * added support for new pg types: * datemultirange * tsmultirange * tstzmultirange * nummultirange * int4multirange * int8multirange * bit * varbit * cid * oid * tid * circle * line * lseg * path * point * polygon
Hi @kyleconroy ! I decided to try to implement the support pgx v5 in the sqlc. I should have discussed the implementation details with you before I started to work. Sorry for this. But It doesn't take too much time, so I opened 3 PRs:
|
@mcdoker18 wow, thank you! I'm a bit short on time right now, so please excuse the slow review times. I'm hoping to get these reviewed within the next week. |
Looking forward to this! |
hopefully this gets merged |
this would allow for using things like https://github.com/jackc/pgx/wiki/Numeric-and-decimal-support which requires pgx/v5 |
…#1873) To support two version of pgx in the e2e tests at the same time we move 'pgx/v4' tests to the separated v4 directory. Then new 'pgx/v4' e2e tests will be located in the v5 dir.
* 'pgx/v5' option requires '--experimental' cli flag. * array, ranges, multiranges uses generic version for 'pgx/v5'. It supports multidemensional arrays. * 'pgx/v5' implementation prefers use pgtype types. For example, pgtype.Bool instead of sql.NullBool. * added support for new pg types: * datemultirange * tsmultirange * tstzmultirange * nummultirange * int4multirange * int8multirange * bit * varbit * cid * oid * tid * circle * line * lseg * path * point * polygon
* 'pgx/v5' option requires '--experimental' cli flag. * array, ranges, multiranges uses generic version for 'pgx/v5'. It supports multidemensional arrays. * 'pgx/v5' implementation prefers use pgtype types. For example, pgtype.Bool instead of sql.NullBool. * added support for new pg types: * datemultirange * tsmultirange * tstzmultirange * nummultirange * int4multirange * int8multirange * bit * varbit * cid * oid * tid * circle * line * lseg * path * point * polygon
I've created a PR with a fix for this one! #1884 |
Hi, seems merged but not working for me when I use pgx/v5 When I try to use pgx/v5 to sqlc.yaml
The output file use database/sql as package
But work perfectly with pgx/v4 with the same configuration.
I tried to use both homebrew installation and docker use to generate and both generate the same thing. I just saw
or
But no success I check in the lastest version of docker and saw support for pgx/v5 but not seem to work Did I miss something? |
https://github.com/kyleconroy/sqlc/blob/main/docs/guides/development.md#building |
Ok thank @mcdoker18 ! Maybe add it to the documentation? Because start with sqlc 2 days ago and really believed it was already included. Do you know when it's gonna be port to docker image? 😊 Thank for you work with v5 btw 👌 |
@kyleconroy decides when new release will be available. |
thank @mcdoker18 , I successfully solved it according to the above!!! However, it is really recommended to update the document and release the corresponding version in a timely manner, so as not to have to go to the issue to find the answer. |
Hi,I encountered a type conversion or search execution problem when using sqlc2 and pgx/v5.See if any experts can help me:
Then the go method generated by sqlc is as follows:
The key now is to generate the parameter
When I reexecuted Did I miss something? Thanks anybody ~ |
In my |
Hi!
(sqlc is current, afaics) |
@alicebob You need to manually build sqlc from main branch and run with experimental flag $ go install github.com/kyleconroy/sqlc@main
$ $GOPATH/bin/sqlc --experimental generate |
@Davincible thanks! I was on |
@Davincible I tried run as you said but i've got this following error: Then, i ran as get started documentation saids: And it works! |
Oh right yes, you're right. Forgot to add the last part |
Any estimate date for the docker image be updated containing support for pgx/v5? |
after yesterday's release, have these issues been all addressed? |
I gave a try on From this query: -- GetAllByIDs :many
SELECT * FROM something WHERE id = ANY($1::uuid[];)
-func (q *Queries) GetAllByIDs(ctx context.Context, dollar_1 []uuid.UUID) ([]*Item, error)
+func (q *Queries) GetAllByIDs(ctx context.Context, dollar_1 pgtype.Array[uuid.UUID]) ([]*Item, error) However, I think that |
@junyan-rippling the v1.17.0 release contained a lot of improvements per https://github.com/kyleconroy/sqlc/releases/tag/v1.17.0 but there are still some outstanding PRs that did not get merged before this release:
|
@kyleconroy @mcdoker18 What is the benefit of using the pgtype.FlatArray or pgtype.Array with pgxv5 instead of a standard go slice in models/queries? Here #1651 I was going to represent multidimensional arrays with a standard multi-dim go slice. I was working on implementing the switch to FlatArray/Array today in that same branch, but found the pgtype.Array to be a bit difficult to work with in some code I was testing. And more generally, is it preferred to return a basic go type or a sql_package specific type (e.g. |
@colli173 sqlc 1.17.2 has been released with greatly improved support for pgx/v5. By default, generated code will use slices |
What do you want to change?
This proposal is a work in progress
v5.0.0 of jackc/pgx is coming in September (jackc/pgx#1273). The changes are significant. I think it's a good opportunity to make some backwards-incompatible changes to fix some long standing issues with our pgx support
What issues should be fixed?
What database engines need to be changed?
PostgreSQL
What programming language backends need to be changed?
Go
The text was updated successfully, but these errors were encountered: