X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DB679D1B4A0 for ; Tue, 2 Dec 2003 20:56:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 93836-08 for ; Tue, 2 Dec 2003 16:55:47 -0400 (AST) Received: from h-e.com (h-68-166-219-83.SNVACAID.covad.net [68.166.219.83]) by svr1.postgresql.org (Postfix) with ESMTP id 9832BD1D550 for ; Tue, 2 Dec 2003 16:55:40 -0400 (AST) Received: from [192.168.42.42] (HELO h-e.com) by h-e.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 421499; Tue, 02 Dec 2003 12:55:47 -0800 Date: Tue, 2 Dec 2003 12:55:46 -0800 Subject: Re: Problem with intervals Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) Cc: pgsql-sql To: "Alexander M. Pravking" From: Bob Smith In-Reply-To: <20031202115348.GK87728@dyatel.antar.bryansk.ru> Message-Id: Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.552) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/22 X-Sequence-Number: 16188 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.