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 issue #2215 - handle OIDs >= 2**31 #2217
Conversation
3c88ab0
to
2c6b37a
Compare
Codecov Report
@@ Coverage Diff @@
## master #2217 +/- ##
=========================================
Coverage 70.75% 70.75%
Complexity 4383 4383
=========================================
Files 200 200
Lines 18394 18394
Branches 3021 3021
=========================================
Hits 13014 13014
Misses 3977 3977
Partials 1403 1403 |
I can't fully validate this PR because I don't have a system on-hand that has had 2**31 OIDs allocated. However, the paths that got updated in #1949 to use OIDs should now be able to correctly handle OIDs > 2**31 - 1, so we should now be able to connect to databases which have such large OIDs without the driver crashing on those large values. |
Hmm... I haven't looked fully at the patch, but can't we fake it somehow to create an oid greater than 2**31? |
seeing that we use Other than that, OIDs are system-assigned, so to guarantee such high values for OIDs we'd need to create somewhere in the order of 2**31 objects, which would take a long time. |
select 3539503657::oid;
|
Yes, |
pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
Outdated
Show resolved
Hide resolved
This is still of value to make sure that we are properly decoding an unsigned int |
d423415
to
20e02b0
Compare
Correctly handle the non-signedness of OIDs in relation to signed java integers in the new OID-based type cache. Previously, this would cause 'bad value for type int'-errors, now this is correctly handled both ways in this part of the code.
As soon as this passes I will push it, I will also backpatch it into the 42.2.x branch |
I'm quite suprised with this failure in appveyor, as it is in a part of the code I haven't touched. The error that was thrown was not |
I'm not too concerned about appveyor failures at the moment, Although history suggests I should be. Thanks |
Correctly handle the non-signedness of OIDs in relation to signed java integers in this new OID-based type storage.
All Submissions:
Changes to Existing Features:
Does this break existing behaviour? If so please explain.
Previously, OIDs >= 2**31 could not be handled by the driver. This was exposed in 42.2.23, when OIDs became the primary source of truth about type information (before that version this was the type string).
Have you added an explanation of what your changes do and why you'd like us to include them?
This patch fixes the bugged behaviour of 42.2.23, and other misbehaviours with int-typed OIDs by first casting the oids to positive Long values, such that the full OID space is represented in integer values, and can be handled correctly.
Have you written new tests for your core changes, as applicable?
Have you successfully run tests with your changes locally?