-
Notifications
You must be signed in to change notification settings - Fork 860
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
The method 'PgResultSet.getInt' will fail with OID values bigger than 2GB (signed 32bit int) in 'pg_type.oid' #2215
Comments
After investigation, I think, that this issue was introduced by this commit: 375cb37#diff-60f28e44064b930bbce27330687834ae571161f1c664a787b83c4e938a0a28fd You can get those big OID values with such SQL:
A rewrite of the code in |
First of all, sorry for that. Mostly due to surrounding code, I hadn't realized that oids are uint32 instead of int32 and the problems related to that. Second of all, this should be fixable without changing all signatures to long, by doing oid extraction/insertion through intermediate long results, and subsequently casting int values to positive long values, such that the full oid space can be extracted from the database. I've created a PR #2217 that should fix this issue for you, could you validate that? |
Thank you very much, I can confirm, that your patch fixes the problem. |
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.
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. Co-authored-by: Matthias van de Meent <[email protected]>
…tegers and were not being handled correctly when they exceeded the size of signed integers
We've also run into this issue and I'm glad to see you've already fixed it! Thank you! I'm pasting here my error code for future reference :)
We're on AWS RDS Aurora PostgreSQL, Engine version 11.9
|
fixed with be1d4aa |
Describe the issue
If 'pg_type.oid' contains OID values, which are bigger than 2GB values (more than 32bit signed int), the method PgResultSet.getInt' will fail. Example:
Caused by: org.postgresql.util.PSQLException: bad value for type int: 3539503657
This seems to be an JDBC driver problem, as the official PostgreQSL documentation states:
The oid type is currently implemented as an unsigned four-byte integer.
Other parts of the JDBC driver also usePgResultSet.getLong
, which won't suffer from the problem. So'PgResultSet.getInt'
should be never used for getting OID, as it could fail with bigger values.Driver Version?
42.2.23
Java Version?
OS Version?
Ubuntu 20.04 LTS
PostgreSQL Version?
12.7-1.pgdg20.04+1
To Reproduce
'pg_type.oid' contains OID values, which are bigger than 2GB values (more than 32bit signed int)
Expected behaviour
If OID values bigger than 32bit signed integer (2GB) are used, it should not fail.
The text was updated successfully, but these errors were encountered: