Skip to content
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: getProcedures returns only procedures (not functions) for psql11+ #1723

Merged
merged 4 commits into from Feb 27, 2020

Conversation

MSGoodman
Copy link
Contributor

@MSGoodman MSGoodman commented Feb 27, 2020

Currently the PGDatabaseMetaData.getProcedures() method returns both
procedures and functions. This made sense prior to PostgreSQL11, but now
actual procedures can be created instead of just functions, and pgjdbc
has an added getFunctions() method to distinguish between the two. For
only PostgreSQL version 11 and onward, this will make getFunctions()
return only functions and getProcedures() return only procedures.

I believe this closes #1340 and closes #1629, which both seem to essentially be
the same thing?

All Submissions:

  • [✓] Have you followed the guidelines in our Contributing document?
  • [✓] Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Existing Features:

  • [?] Does this break existing behaviour? If so please explain.

I am unsure if this should be considered breaking. Since PostgreSQL 11 has been out since 2018, I assume there is some code out there relying on the assumption that getProcedures() returns both functions and procedures rather than just procedures. ¯\(ツ)

  • [✓] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [✓] Have you written new tests for your core changes, as applicable?
  • [✓] Have you successfully run tests with your changes locally?

Currently the PGDatabaseMetaData.getProcedures() method returns both
procedures and functions. This made sense prior to PostgreSQL11, but now
actual procedures can be created instead of just functions, and pgjdbc
has an added getFunctions() method to distinguish between the two. For
only PostgreSQL version 11 and onward, this will make getFunctions()
return only functions and getProcedures() return only procedures.

I believe this closes pgjdbc#1340 and pgjdbc#1629, which both seem to essentially be
the same thing?
@MSGoodman
Copy link
Contributor Author

MSGoodman commented Feb 27, 2020

Ah, silly me, I try to do create procedure in the setup regardless of the postgres version, which obviously causes issues, fixing now

@MSGoodman
Copy link
Contributor Author

MSGoodman commented Feb 27, 2020

Hrm, my apologies, I also need to fix testGetProcedures. It appears I had an owner-superuser so that test wasn't running correctly. Will correct promptly.

@codecov-io
Copy link

codecov-io commented Feb 27, 2020

Codecov Report

Merging #1723 into master will increase coverage by 0.11%.
The diff coverage is 50%.

@@             Coverage Diff              @@
##             master    #1723      +/-   ##
============================================
+ Coverage      69.3%   69.42%   +0.11%     
- Complexity     4195     4201       +6     
============================================
  Files           187      187              
  Lines         17265    17278      +13     
  Branches       2870     2872       +2     
============================================
+ Hits          11966    11995      +29     
+ Misses         4015     3997      -18     
- Partials       1284     1286       +2

@davecramer davecramer merged commit 5fbe046 into pgjdbc:master Feb 27, 2020
3 checks passed
davecramer pushed a commit to davecramer/pgjdbc that referenced this issue Jul 5, 2021
pgjdbc#1723)

* fix: getProcedures returns only procedures (not functions) for psql11+

Currently the PGDatabaseMetaData.getProcedures() method returns both
procedures and functions. This made sense prior to PostgreSQL11, but now
actual procedures can be created instead of just functions, and pgjdbc
has an added getFunctions() method to distinguish between the two. For
only PostgreSQL version 11 and onward, this will make getFunctions()
return only functions and getProcedures() return only procedures.

I believe this closes pgjdbc#1340 and pgjdbc#1629, which both seem to essentially be
the same thing?

* only create procedure in tests for psql versions 11 and higher

* testGetProcedures now checks for functions or procedures depending on psql version

* only test 'create procedure' for psql 11+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants