9tigerio / db2rest-web

DB2Rest Website
https://db2rest.com
6 stars 3 forks source link

Call Stored Procedure error with Posgres Database - "To call a procedure, use CALL." #13

Closed souravroy closed 6 days ago

souravroy commented 10 months ago

We seem to get below error with Postgres Stored procedure during integration test or while we test /procedure/{procName} endpoint using Postman:

Caused by: org.postgresql.util.PSQLException: ERROR: getmovierentalrateproc(character varying) is a procedure
  Hint: To call a procedure, use CALL.
  Position: 15
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)

Root cause of the error:

After PostgreSQL 11, PostgreSQL JDBC driver team has introduced a ENUM name EscapeSyntaxCallMode in PostgreSQL driver version 42.2.16... https://stackoverflow.com/questions/65696904/postgresql-11-stored-procedure-call-error-to-call-a-procedure-use-call-java

Fix:

When we test using Postman, please make sure DB_URL is configured as: DB_URL=jdbc:postgresql://localhost:5432/sakila?escapeSyntaxCallMode=callIfNoReturn

When running integration test we can add below config to the datasource: dataSourceBuilder.url(testPostgres.getJdbcUrl() + "&escapeSyntaxCallMode=callIfNoReturn");