| From: | Dan99 <power919(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: To many records returned |
| Date: | 2008-04-04 00:36:53 |
| Message-ID: | 22479c84-506c-4c10-ba39-40bff63ddb78@r9g2000prd.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Apr 3, 9:02 pm, jus(dot)(dot)(dot)(at)emproshunts(dot)com (Justin) wrote:
> 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.
>
> --
> Sent via pgsql-general mailing list (pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general
I believe you are correct in your explanation of the problem. The
solution is to use your second query or one such as this :
Select * from sometable where DateStampColumn >= '2008-04-01'
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sam Mason | 2008-04-04 00:37:30 | Re: [GENERAL] SHA1 on postgres 8.3 |
| Previous Message | Rodrigo Gonzalez | 2008-04-04 00:23:28 | Re: To many records returned |