From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Justin <justin(at)emproshunts(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: To many records returned |
Date: | 2008-04-04 01:15:08 |
Message-ID: | 29758.1207271708@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Justin <justin(at)emproshunts(dot)com> writes:
> 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
There's no such thing as "timestamp compared to date". The date
promotes to a timestamp at midnight; what you wrote is equivalent
to
Select * from sometable where DateStampColumn > '2008-03-31 00:00:00'
> but when the query includes casting to date
> Select * from sometable where DateStampColumn::date > '2008-03-31'
> The result is correct
You threw away the intraday part of the timestamp...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Colin Wetherbee | 2008-04-04 02:08:36 | Re: Autograph Annoucement (ERD Tool) |
Previous Message | Colin Fox | 2008-04-04 01:08:26 | Re: Autograph Annoucement (ERD Tool) |