BUG #4317: problem with comparision of datatype date - Mailing list pgsql-bugs

From Sanjay Rajdev
Subject BUG #4317: problem with comparision of datatype date
Date
Msg-id 200807181539.m6IFdQPa042669@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4317: problem with comparision of datatype date  (Craig Ringer <craig@postnewspapers.com.au>)
Re: BUG #4317: problem with comparision of datatype date  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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.

pgsql-bugs by date:

Previous
From: "Bhaskar Sirohi"
Date:
Subject: Re: BUG #4312: Installation fails
Next
From: "Dave Page"
Date:
Subject: Re: BUG #4312: Installation fails