Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Fri, 24 Jan 2025 08:56:46 +0000 Subject: [pgjdbc/pgjdbc] PR #3497: refactor: factor out duplicated .getBytes() when converting date/time to Date/Time/Timestamp List-Id: X-GitHub-Author-Id: 213894 X-GitHub-Author-Login: vlsi X-GitHub-Issue: 3497 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: merged X-GitHub-Type: pull_request X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3497 Content-Type: text/plain; charset=utf-8 At best, we should avoid `byte[] -> String -> byte[]` conversions when dealing with datetime, however, currently PgCallableStatement uses getObject eagerly, so we lose the underlying wire format byte[] early. That is why we have to use .toString() when converting to date. Ideally, we should keep the source byte[] data and convert it on request. --- The change avoids `getBytes()` with the default encoding. I believe, date-time use limited alphabet, so the encoding should not matter much. However, the use of the default encoding was not the best choice.