Moritz Kobel created GROOVY-8155:
------------------------------------

             Summary: No types when executing PostgreSQL stored procedure
                 Key: GROOVY-8155
                 URL: https://issues.apache.org/jira/browse/GROOVY-8155
             Project: Groovy
          Issue Type: Bug
          Components: SQL processing
    Affects Versions: 2.4.10, 2.4.9
            Reporter: Moritz Kobel


Since 2.4.9 I can no longer execute stored procedures:

The following code causes an exception:
{code}
def sql = Sql.newInstance(jdbcUrl,user,pass)

        def result = false
        sql.call('{? = call myproc(?, ?) }', [
                Sql.BOOLEAN,
                Sql.BIGINT(1),
        ], { res ->
            result = res
        })
{code}

The exception:
{code}
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.
{code}

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)}} ):
{code}
ParameterMetaData metaData = statement.getParameterMetaData();
{code}

This line is introduced here: 
https://github.com/apache/groovy/pull/495/commits/93f703f53b01a0b0205d8efa364c3efb97758d31#diff-c1c769ea9cf64ea997ca82e512653990R4111






--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to