BUG #4317: problem with comparision of datatype date

From: "Sanjay Rajdev" <sanjay(dot)rajdev(at)featherstoneinformatics(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4317: problem with comparision of datatype date
Date: 2008-07-18 15:39:26
Message-ID: 200807181539.m6IFdQPa042669@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4317
Logged by: Sanjay Rajdev
Email address: sanjay(dot)rajdev(at)featherstoneinformatics(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dave Page 2008-07-18 16:18:11 Re: BUG #4312: Installation fails
Previous Message Bhaskar Sirohi 2008-07-18 12:07:44 Re: BUG #4312: Installation fails