Thread: Migration from Postgres 7.3 to 8.1.1: Getting No results were returned for function calls

Hello Group,

I am in the process of migrating Postgres from version 7.3 to 8.1.1 on
the Linux 5 server with JDK 1.6 installed and I am using
“postgresql-8.3-604.jdbc4.jar”.

When I try to call a Postgres function from my Java code I am
receiving the following error.
org.postgresql.util.PSQLException: No results were returned by the query.
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
    at com.echospace.wizard.db.WizardJDBCConnection.doStoredQuery(WizardJDBCConnection.java:251)

When I execute the query from the Postgres 8.1.1 Admin tool I received
1 row with the message“<unnamed portal 1>”. Also the same query and
code is working fine on the Postgres 7.3 with JDK 1.4.
My query to call the function looks like “BEGIN; SELECT
Get_options('1234','D','123456');” I have also tried executing this
query on Postgres 7.3 admin tool and received “<unnamed cursor 1>”
message.

Java code for executing the function looks like this.
    public static StoredQueryResult doStoredQuery( String query ,
Connection db_connection) throws WizardDatabaseException {

        String orginalQuery = query;

        Statement statement = null;
        try {
            statement = db_connection.createStatement();
        }
        catch ( Exception e ) {
            throw new WizardDatabaseException( "Error getting statement for
database query.", e );
        }

        // do the query, and get the cursor
        ResultSet result = null;
        String cursor = null;
        query = "BEGIN; " + query;
        Exception exceptionToThrow = null;
        try {
            result = statement.executeQuery(query);
        }
        catch ( SQLException ex ) {…..}

I would really appreciate your help in resolving this issue

Thank you for your help in advance.

Regards
Sriganesh