From: | Rodrigo Gonzalez <rjgonzale(at)gmail(dot)com> |
---|---|
To: | Justin <justin(at)emproshunts(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: To many records returned |
Date: | 2008-04-04 00:23:28 |
Message-ID: | 47F57500.6010908@gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Justin escribió:
> Have a select statement with a where clause using datestamp with
> timezone column compared to a date
> Select * from sometable where DateStampColumn > '2008-03-31'
> this returns records that are equal 2008-03-31
>
> but when the query includes casting to date
> Select * from sometable where DateStampColumn::date > '2008-03-31' The
> result is correct
>
> What is causing the difference in the results
>
> My guess is '2008-03-31' is being cast into a datestamp value of
> 2008-03-31 00:00:00.00-00 which would explain why one query returns
> more records.
>
I am almost sure your problem is that casting is done to text....so
2008-03-31 00:00:01 is greater than 2008-03-31 so that date is included....
Explicit casting is the right thing to do (your second query)
From | Date | Subject | |
---|---|---|---|
Next Message | Dan99 | 2008-04-04 00:36:53 | Re: To many records returned |
Previous Message | Kevin Reynolds | 2008-04-04 00:22:20 | Text Search Configuration Problem |