pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: victornoel (@victornoel) <[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 08:57:33 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
@vlsi
> What do you mean by "properly"?
I guess I mean that when you look at the implementation of `PgPreparedStatement#setDate(int, java.sql.Date, java.util.Calendar)` or `PgPreparedStatement#setTimestamp(int, java.sql.Timestamp, java.util.Calendar)`, you can see it's using `Oid.UNSPECIFIED` most of the time to propagate the type to the server.
I just discovered this, I didn't know it when I wrote my first comment but I was intuiting this kind of thing.
> Frankly, I would suggest to use java.time types instead of java.sql types.
So you mean one should be doing `setObject(LocalDate.of(2013, 03, 21))` instead of `setDate(java.sql.Date.valueOf(LocalDate.of(2013, 03, 21)))` right?
It's indeed a good workaround right now, it's unfortunately not followed by libs like Hibernate that will directly use `setTimestamp()` or `setDate()` but I guess it's also workaroundable.
> Is there a reason you have to use java.sql types without casts?
Is there a reason that we should be using casts? I mean: the only workaround currently is to do use casts, so that's what is going to be done, but we thought there was maybe something wrong going on a the driver level and decided to start a discussion here about it.
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