Message-ID: From: "davecramer (@davecramer)" To: "pgjdbc/pgjdbc" Date: Fri, 17 Jan 2025 18:25:03 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3482: When using java.sql.Timestamp for update, an exception thrown In-Reply-To: References: List-Id: X-GitHub-Author-Login: davecramer X-GitHub-Comment-Id: 2598950583 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3482 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3482#issuecomment-2598950583 Content-Type: text/plain; charset=utf-8 One of the problems is that postgres supports 2 timestamp types; JAVA and JDBC only support one. Usually the backend can figure out what you want to do but it appears in a merge it has difficulties For instance this: ``` try (Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost/test", "test", "test")) { PreparedStatement ps = conn.prepareStatement("insert into test ( id, ts, amount ) values (?,?,?)"); Integer id = 2; Timestamp ts = Timestamp.valueOf(LocalDateTime.now()); Integer amount = 123; ps.setObject(1, id); ps.setTimestamp(2, ts); ps.setObject(3, amount); ps.executeUpdate(); } ``` works fine but merge doesn't seem to. So might be worth posting this to the pgsql-hackers list. Dave