From: | "Alexander M(dot) Pravking" <fduch(at)antar(dot)bryansk(dot)ru> |
---|---|
To: | Bob Smith <bsmith(at)h-e(dot)com> |
Cc: | pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Problem with intervals |
Date: | 2003-12-02 11:53:48 |
Message-ID: | 20031202115348.GK87728@dyatel.antar.bryansk.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Mon, Dec 01, 2003 at 09:09:20PM -0800, Bob Smith wrote:
> I'm getting an unexpected result using intervals in an expression:
>
> select ('2003-10-26 0:00:00'::timestamp + '1 day'::interval)::date;
> date
> ------------
> 2003-10-26
> (1 row)
Try using '2003-10-26 0:00:00'::date + 1;
integers do not lie ;-)
> When I get rid of the date cast it becomes clear what is happening:
>
> select '2003-10-26 0:00:00'::timestamp + '1 day'::interval;
> ?column?
> ------------------------
> 2003-10-26 23:00:00-08
> (1 row)
>
> Is this a Postgres bug, or is this correct SQL behavior? I'm running
> Postgres 7.2.2.
It has been discussed several times, Tom Lane offered to add 'day' as
a separate interval unit (like 'second' and 'month' at this moment),
but noone took a shot at it, AFAIK.
Note also, that in 7.3 "timestamp" means "timestamp without time zone",
while in 7.2 it's "timestamp with time zone".
--
Fduch M. Pravking
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-12-02 14:51:00 | Re: Problem with intervals |
Previous Message | Alexander M. Pravking | 2003-12-02 10:58:35 | Re: Validity check in to_date? |