From: Bob Smith <bsmith@h-e.com>
To: Alexander M. Pravking <fduch@antar.bryansk.ru>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Problem with intervals
Date: Tue, 2 Dec 2003 12:55:46 -0800
Message-ID: <E6FD177F-2509-11D8-8F43-0003933DD370@h-e.com> (raw)
In-Reply-To: <20031202115348.GK87728@dyatel.antar.bryansk.ru>
On Tuesday, Dec 2, 2003, at 03:53 US/Pacific, Alexander M. Pravking
wrote:
> 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 ;-)
Aha! That solves my problem for now. I had also discovered that using
'25 hours'::interval works, but the integer approach is better.
> 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".
Yet another reason to upgrade, I guess I'm gonna have to do it soon...
Thanks for your help!
Bob S.
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: bsmith@h-e.com, fduch@antar.bryansk.ru
Subject: Re: Problem with intervals
In-Reply-To: <E6FD177F-2509-11D8-8F43-0003933DD370@h-e.com>
* 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