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
Rework sql type gathering to use OID instead of typname. #1949
Rework sql type gathering to use OID instead of typname. #1949
Conversation
There is a small fix required to appease checkstyle, otherwise looks fine. I would like a test where the a type of the same name is created in a different schema just for completeness |
14fc3cc
to
c9e274e
Compare
I've cleaned up the code a bit, and made it into one commit that follows the commit style guide. |
Codecov Report
@@ Coverage Diff @@
## master #1949 +/- ##
============================================
+ Coverage 65.35% 69.33% +3.97%
- Complexity 3955 4226 +271
============================================
Files 197 197
Lines 18006 18012 +6
Branches 2919 2920 +1
============================================
+ Hits 11768 12488 +720
+ Misses 4878 4167 -711
+ Partials 1360 1357 -3 |
"Special has been given to the oid of Oid.UNSPECIFIED, as that needs to be mapped to Types.OTHER without needing to query the database." Can you fix this up ? |
What do you mean with 'fix up'? Should I remove it from the commit message, or did you mean something else? |
It doesn't read properly I presume you mean Special consideration ? |
…es not have the issue of name shadowing / qual-names, and has the added benefit of fixing pgjdbc#1948. Types that are not on the search path (e.g. they are shadowed, or in a schema that is not included in the search path) are stored in the caches as fully qualified type names and OIDs. As we cannot easily query the pg_type catalog using qualified type names, we replace the pgTypeName with the oid of the type name to query properties of the type. Testcases are added to improve coverage of correctly detecting SQL types that are not on the path, but are available through OID or qualified lookup. These types are stored internally as a fully qualified type, but we cannot use this name for lookup in pg_type. Special consideration has been given to Oid.UNSPECIFIED, as that needs to be mapped to Types.OTHER without first hitting the database. That mapping is static, but is not in `types` because it is not an actual type. Fixes pgjdbc#1948
c9e274e
to
d56817f
Compare
Ah, yes, I indeed messed that up, and read over that mistake thrice already? I believe that's fixed. |
@davecramer I wouldn't want to come across as impatient, but at what timeframe could I expect this to be released? Is there some release schedule I could lookup for pgjdbc? |
I wouldn't expect to see a release before the end of the year. I know I'm going to be pinned, not sure about @vlsi ? |
Fix: Rework sql type gathering to use OID instead of typname. This do… …es not have the issue of name shadowing / qual-names, and has the added benefit of fixing pgjdbc#1948. Types that are not on the search path (e.g. they are shadowed, or in a schema that is not included in the search path) are stored in the caches as fully qualified type names and OIDs. As we cannot easily query the pg_type catalog using qualified type names, we replace the pgTypeName with the oid of the type name to query properties of the type. Testcases are added to improve coverage of correctly detecting SQL types that are not on the path, but are available through OID or qualified lookup. These types are stored internally as a fully qualified type, but we cannot use this name for lookup in pg_type. Special consideration has been given to Oid.UNSPECIFIED, as that needs to be mapped to Types.OTHER without first hitting the database. That mapping is static, but is not in `types` because it is not an actual type. Fixes pgjdbc#1948
Fix: Rework sql type gathering to use OID instead of typname. This does not have the issue of name shadowing / qual-names, and has the added benefit of fixing #1948. Types that are not on the search path (e.g. they are shadowed, or in a schema that is not included in the search path) are stored in the caches as fully qualified type names and OIDs. As we cannot easily query the pg_type catalog using qualified type names, we replace the pgTypeName with the oid of the type name to query properties of the type. Testcases are added to improve coverage of correctly detecting SQL types that are not on the path, but are available through OID or qualified lookup. These types are stored internally as a fully qualified type, but we cannot use this name for lookup in pg_type. Special consideration has been given to Oid.UNSPECIFIED, as that needs to be mapped to Types.OTHER without first hitting the database. That mapping is static, but is not in `types` because it is not an actual type. Fixes #1948
So this has caused a fair bit of a regression as we are now querying the database for almost every type. Changes startup times considerably see issue #2236 |
… all types by OID, we can return types for well known types
This is more stable, and has the added benefit of fixing #1948.
I'd like to remove the pgNameToSQLType map too, but that's used for the public api of getPGTypeNamesWithSQLTypes() - I'm not certain I can just remove that and be done with it...
All Submissions:
Changes to Existing Features: