From: Alexander M. Pravking <fduch@antar.bryansk.ru>
To: Bob Smith <bsmith@h-e.com>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Problem with intervals
Date: Tue, 2 Dec 2003 14:53:48 +0300
Message-ID: <20031202115348.GK87728@dyatel.antar.bryansk.ru> (raw)
In-Reply-To: <AFC6FD04-2485-11D8-A180-0003933DD370@h-e.com>
References: <AFC6FD04-2485-11D8-A180-0003933DD370@h-e.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: fduch@antar.bryansk.ru, bsmith@h-e.com
Subject: Re: Problem with intervals
In-Reply-To: <20031202115348.GK87728@dyatel.antar.bryansk.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox