Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Fri, 06 Jun 2025 08:49:27 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #2648: Fix getObject(int, class) In-Reply-To: References: List-Id: X-GitHub-Author-Login: vlsi X-GitHub-Comment-Id: 2131794070 X-GitHub-Comment-Type: review_comment X-GitHub-Commit: 55b49295abfee54d3d5a930d9339cbf7d20a583b X-GitHub-Issue: 2648 X-GitHub-Line: 665 X-GitHub-Path: pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: review_comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/2648#discussion_r2131794070 Content-Type: text/plain; charset=utf-8 (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