Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.9, 2.4.10
-
None
Description
Since 2.4.9 I can no longer execute stored procedures:
The following code causes an exception:
def sql = Sql.newInstance(jdbcUrl,user,pass) def result = false sql.call('{? = call myproc(?, ?) }', [ Sql.BOOLEAN, Sql.BIGINT(1), Sql.BIGINT(1) ], { res -> result = res })
The exception:
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: function myproc(unknown, unknown, unknown) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
The exception occurs using 'postgresql:postgresql:9.0-801.jdbc4' and 'org.postgresql:postgresql:42.0.0.jre7'
I assume the following line causes the execution of the procedure before the parameters are set (subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java in protected void setParameters(List<Object> params, PreparedStatement statement) ):
ParameterMetaData metaData = statement.getParameterMetaData();
This line is introduced here: https://github.com/apache/groovy/pull/495/commits/93f703f53b01a0b0205d8efa364c3efb97758d31#diff-c1c769ea9cf64ea997ca82e512653990R4111