The following bug has been logged online:
Bug reference: 4317
Logged by: Sanjay Rajdev
Email address: sanjay.rajdev@featherstoneinformatics.com
PostgreSQL version: 8.3.1
Operating system: Window Server 2003
Description: problem with comparision of datatype date
Details:
I installed a new PostgreSQL server 8.3.1 few days back, and then restored a
backup taken from our old server which had older version of PostgreSQL
Server.
We have a application that uses this database, and at most of the place we
have used = sign for date comparision.
Here is what is happening, I have a datatype "date" column in my database
called "somedate" there are 277 rows in the database which have "somedate" =
"2008-07-18".
When I execute the below query
"select * from myTable where somedate = '2008-07-18'"
I only get 145 rows back from the database.
If I execute
"select * from myTable where somedate = cast('2008-07-18' as Date)"
Still I get 145 rows
If I execute
"select * from myTable where somedate between '2008-07-18' and
'2008-07-18'"
I get all 277 rows.
I don't know what is wrong in the first and second queries. Can someone
please help?
we have used similar queries at most of place in our application.