pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: DmitriyGod (@DmitriyGod) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3563: CallableStatement.getObject(parameterIndex, toClass) does not works
Date: Mon, 10 Mar 2025 15:43:19 +0000
Message-ID: <[email protected]> (raw)

**Describe the issue**
CallableStatement.getObject(parameterIndex, toClass) does not works.

**Driver Version?** 
latest

**Java Version?**
any

**OS Version?**
any

**PostgreSQL Version?**
latest

**To Reproduce**
```SQL
create procedure p_date(in a date, out b date)
language plpgsql AS $$ begin b = a; end; $$;
```

```Java
var call = cn.prepareCall("call p_date(?, ?)");
call.setObject(1, LocalDate.of(1970, 1, 1));
call.registerOutParameter(2, Types.DATE);
call.execute();

var v = call.getObject(2, LocalDate.class);
```

**Expected behaviour**
No exception. Instance of LocalDate returned.

**Logs**
```
Unsupported type conversion to {1}.
org.postgresql.util.PSQLException: Unsupported type conversion to {1}.
at org.postgresql.jdbc.PgCallableStatement.getObject(PgCallableStatement.java:735)
```

it looks like it's not implemented
```Java
public <T> @Nullable T getObject(int parameterIndex, Class<T> type) throws SQLException {
        if (type == ResultSet.class) {
            return type.cast(this.getObject(parameterIndex));
        } else {
            throw new PSQLException(GT.tr("Unsupported type conversion to {1}.", new Object[]{type}), PSQLState.INVALID_PARAMETER_VALUE);
        }
 }
```

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #3563: CallableStatement.getObject(parameterIndex, toClass) does not works
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox