pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: tbroyer (@tbroyer) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #3845: Wrong result on equality between Date and Timestamp given as query parameter
Date: Wed, 22 Oct 2025 13:01:56 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

> > And AFAICT, `java.sql.Timestamp` is by definition a `timestamp`, not a `timestamptz`
> 
> I gather you are suggesting that we should always treat it as a timestamp then?

Yes

> If so how would one set a timestamptz in older versions of the JDK ?

You can't.

I don't make the rules, the JCP does.

And [JDBC 4.3 (pdf)](https://download.oracle.com/otn-pub/jcp/jdbc-4_3-mrel3-eval-spec/jdbc4.3-fr-spec.pdf) only lists TIMESTAMP_WITH_TIMEZONE associated with java.time.OffsetDateTime when java.sql.Timestamp is only ever associated with TIMESTAMP, and [JDBC 2.1](https://web.archive.org/web/20001018172021/http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/app...) which added "support for time zones" back in the day only added the `setTimestamp()` overloads taking an additional `Calendar` argument, but note that [the javadoc](https://docs.oracle.com/en/java/javase/25/docs/api/java.sql/java/sql/PreparedStatement.html#setTimes...)) says it uses the `Calendar` object to determine the time zone to use to compute the value instead of the local time zone, but still constructs a `TIMESTAMP` SQL value!

view thread (17+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #3845: Wrong result on equality between Date and Timestamp given as query parameter
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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