-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
Upgrade jackc/pgx to v5 #819
Conversation
Version 5 of pgx finally resolves some long-awaited issues when PostgreSQL shuts down. The upgrade is a drop-in replacement with the only change being the pgconn import path. See ory/hydra#3432 Signed-off-by: aeneasr <[email protected]>
In order to support improve PostgreSQL connectivity, Go 1.18 is required. Go 1.17's support ended 7 months ago. Signed-off-by: aeneasr <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment on Float
which could be applied to the others too. Otherwise, it looks good to me!
Thanks!
@@ -20,6 +20,9 @@ func (f Float) Interface() interface{} { | |||
func (f *Float) Scan(src interface{}) error { | |||
var str string | |||
switch t := src.(type) { | |||
case nil: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be changed to the general nil
checking like the String
case for readability? The other types too, including Map
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, that change broke the whole thing haha. We must distinguish between a nil interface and a non-nil interface backed by nil.
I've changed the String
case to match the other implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a different confusion here. if the type switch's case nil
works like your PR, that means the src
has no specific type and is actually nil
so src == nil
should be true. If the src
is a "non-nil interface with a nil
value", the type of src
can't be nil
and the case nil
will not work. What is the actual src
in here? something like *[]string(nil)
?
I hope we have enough description on the PR or linked issue so we can have a solid reference for the chance in the code history.
pgx/v5 is a pretty big change from v4. I've changed this PR back to draft while waiting for some insights here: jackc/pgx#1566 |
Superseded by #835 |
What is being done in this PR?
Closes #818
Supersedes #814
What are the main choices made to get to this solution?
jackc/pgx/v5 has slightly different handling of SQL NULLs than v4. Otherwise, this was a drop-in replacement.
List the manual test cases you've covered before sending this PR:
Ran tests against postgres locally.