[BUG]: Fixed procedure/function definition and exdecution logic for PostgreSQL #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PostgreSQL have had official support for Procedures since version 11 released in 2018. Dreamfactorys' implementation for handling functions and procedures dates before that, and handles it based on IN/OUT params for those, which from version PG 11 is no longer accurate. This commit fixes this to correctly look at the ROUTINE_TYPE value in the database information schema to determine if it is an procedure or function.
The important part for this is that procedures needs to be executed using "CALL" where functions are executed using "SELECT", this leads to that the current implementation are not able to execute procedures at all and throws errors when trying to do it, which this commit fixes.
This would be a breaking change for applications that calls actual Postgres functions using the incorrect "_proc/" endpoints, which would then need to be updated to call the correct "_func/" endpoint instead.
I have tested and verified that executing both functions and procedures are working after this fix.