pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
10+ messages / 3 participants
[nested] [flat]

* [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2022-10-21 18:39 "davecramer (@davecramer)" <[email protected]>
  0 siblings, 0 replies; 10+ messages in thread

From: davecramer (@davecramer) @ 2022-10-21 18:39 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

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

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2022-10-22 08:20 ` "anatoly-spb (@anatoly-spb)" <[email protected]>
  8 siblings, 0 replies; 10+ messages in thread

From: anatoly-spb (@anatoly-spb) @ 2022-10-22 08:20 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(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)
```


^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2022-10-22 09:34 ` "davecramer (@davecramer)" <[email protected]>
  8 siblings, 0 replies; 10+ messages in thread

From: davecramer (@davecramer) @ 2022-10-22 09:34 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

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

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

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2022-12-01 15:41 ` "davecramer (@davecramer)" <[email protected]>
  8 siblings, 0 replies; 10+ messages in thread

From: davecramer (@davecramer) @ 2022-12-01 15:41 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

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

@anatoly-spb ??

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2023-01-31 14:13 ` "anatoly-spb (@anatoly-spb)" <[email protected]>
  8 siblings, 0 replies; 10+ messages in thread

From: anatoly-spb (@anatoly-spb) @ 2023-01-31 14:13 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

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

It looks good

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2025-06-06 08:20 ` "anatoly-spb (@anatoly-spb)" <[email protected]>
  8 siblings, 0 replies; 10+ messages in thread

From: anatoly-spb (@anatoly-spb) @ 2025-06-06 08:20 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Any news about merge this MR?

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2025-06-06 08:46 ` "vlsi (@vlsi)" <[email protected]>
  8 siblings, 0 replies; 10+ messages in thread

From: vlsi (@vlsi) @ 2025-06-06 08:46 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

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

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

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2025-06-06 08:49 ` "vlsi (@vlsi)" <[email protected]>
  8 siblings, 0 replies; 10+ messages in thread

From: vlsi (@vlsi) @ 2025-06-06 08:49 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(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

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2025-06-06 08:51 ` "vlsi (@vlsi)" <[email protected]>
  8 siblings, 0 replies; 10+ messages in thread

From: vlsi (@vlsi) @ 2025-06-06 08:51 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

@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?

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class)
@ 2025-06-17 12:46 ` "anatoly-spb (@anatoly-spb)" <[email protected]>
  8 siblings, 0 replies; 10+ messages in thread

From: anatoly-spb (@anatoly-spb) @ 2025-06-17 12:46 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

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

^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2025-06-17 12:46 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 18:39 [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class) "davecramer (@davecramer)" <[email protected]>
2022-10-22 08:20 ` "anatoly-spb (@anatoly-spb)" <[email protected]>
2022-10-22 09:34 ` "davecramer (@davecramer)" <[email protected]>
2022-12-01 15:41 ` "davecramer (@davecramer)" <[email protected]>
2023-01-31 14:13 ` "anatoly-spb (@anatoly-spb)" <[email protected]>
2025-06-06 08:20 ` "anatoly-spb (@anatoly-spb)" <[email protected]>
2025-06-06 08:46 ` "vlsi (@vlsi)" <[email protected]>
2025-06-06 08:49 ` "vlsi (@vlsi)" <[email protected]>
2025-06-06 08:51 ` "vlsi (@vlsi)" <[email protected]>
2025-06-17 12:46 ` "anatoly-spb (@anatoly-spb)" <[email protected]>

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