From: | Adam Rich <adam(dot)r(at)sbcglobal(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | time math - Bug or expected behavior? |
Date: | 2008-08-27 02:39:00 |
Message-ID: | 105742.4118.qm@web81402.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I traced a bug in our application down to this basic operation:
set timezone to 'US/Eastern';
select '11/02/2008'::timestamptz, '12:10'::time,
'11/02/2008'::timestamptz + '12:10'::time;
I have a date and a time stored separately and I want to combine them,
and use them in some timezone-aware calculations. When I add the time
12:10 to the date 11/2/08, I expect the timestamp "11/2/08 12:10" but
instead, I get "11/2/08 11:10".
It's probably not coincidence that daylight saving time rolls back one hour
on the morning of 11/2. Still, I would have expected the above behavior
when adding an interval to a timestamp, but not a time. Is the time being
cast to an interval before the add? Is there a better way to combine a
date with a time and get a timestamptz ? (the values are stored in the database, and are not literals as in my example)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-08-27 03:11:55 | Re: time math - Bug or expected behavior? |
Previous Message | Anderson dos Santos Donda | 2008-08-27 02:35:22 | Re: Postgre connect on Postgre |