Subject: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)

From: "davecramer (@davecramer)" <[email-masked]>
Date: Fri, 21 Oct 2022 18:39:39 +0000

fixes #2647 
More tests are required, but this just to prove that it works

---

From: "anatoly-spb (@anatoly-spb)" <[email-masked]>
Date: Sat, 22 Oct 2022 08:20:42 +0000

(on pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java:662)

It seems to me the {1} substitution does not work as you can see in stack trace: 
```
org.postgresql.util.PSQLException: Unsupported type conversion to {1}.
	at org.postgresql.jdbc.PgCallableStatement.getObject(PgCallableStatement.java:663)
```

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Sat, 22 Oct 2022 09:34:08 +0000

ah, good catch, thanks, but the rest works, right ?

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Thu, 01 Dec 2022 15:41:38 +0000

@anatoly-spb ??

---

From: "anatoly-spb (@anatoly-spb)" <[email-masked]>
Date: Tue, 31 Jan 2023 14:13:04 +0000

It looks good

---

From: "anatoly-spb (@anatoly-spb)" <[email-masked]>
Date: Fri, 06 Jun 2025 08:20:14 +0000

Any news about merge this MR?

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Fri, 06 Jun 2025 08:46:42 +0000

Why is this comparing with `ResultSetMetaData.class`? It looks odd to reject only one class here

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Fri, 06 Jun 2025 08:49:27 +0000

(on pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java:665)

This conversion does not look right.
I believe we should mimic `PgResultSet#getObject(int, Class)` so we use proper conversion methods for various types.
For instance, if a call returns `Timestamp`, and the user asks `getObject(1, String.class)` we should probably return a string-based representation rather than failing with `ClassCastException`.

The same goes for `getObject(1, LocalDateTime.class)`.
If we ever support more classes, we'd better add the relevant tests for it rather than release a feature and get a lot of complains on `ClassCastException` later

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Fri, 06 Jun 2025 08:51:47 +0000

@anatoly-spb , thanks for the ping. I am afraid the current PR implementation lacks tests, so we can't ship it yet. Do you think you could help contributing tests for the change?

---

From: "anatoly-spb (@anatoly-spb)" <[email-masked]>
Date: Tue, 17 Jun 2025 12:46:34 +0000

@vlsi I am ready to write tests. Could you please point me to contribute manual how to do it.