X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4D8B29DCC4A; Wed, 1 Mar 2006 16:28:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86475-08; Wed, 1 Mar 2006 16:28:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.skype.net (mail.skype.net [195.215.8.149]) by postgresql.org (Postfix) with ESMTP id D20C39DCC7C; Wed, 1 Mar 2006 16:28:46 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.skype.net (Postfix) with ESMTP id 358244DE0A; Wed, 1 Mar 2006 21:28:48 +0100 (CET) Received: from [10.10.10.6] (217-159-136-226-dsl.kt.estpak.ee [217.159.136.226]) by mail.skype.net (Postfix) with ESMTP id 354F94DE0B; Wed, 1 Mar 2006 21:28:41 +0100 (CET) Subject: Re: [SQL] Interval subtracting From: Hannu Krosing To: Bruce Momjian Cc: Stephan Szabo , Tom Lane , "Milen A. Radev" , pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org In-Reply-To: <200603012018.k21KIhi22006@candle.pha.pa.us> References: <200603012018.k21KIhi22006@candle.pha.pa.us> Content-Type: text/plain; charset=utf-8 Date: Wed, 01 Mar 2006 22:28:39 +0200 Message-Id: <1141244920.3737.10.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.065 required=5 tests=[AWL=0.065] X-Spam-Score: 0.065 X-Spam-Level: X-Archive-Number: 200603/51 X-Sequence-Number: 80449 Ühel kenal päeval, K, 2006-03-01 kell 15:18, kirjutas Bruce Momjian: > Stephan Szabo wrote: > > > justify_days doesn't currently do anything with this result --- it > > > thinks its charter is only to reduce day components that are >= 30 days. > > > However, I think a good case could be made that it should normalize > > > negative days too; that is, the invariant on its result should be > > > 0 <= days < 30, not merely days < 30. > > > > What about cases like interval '1 month -99 days', should that turn into > > interval '-3 mons +21 days' or '-2 mons -9 days'? > > I think it should be the later. It is best to have a single sign, and I > think it is possible in all cases: > > '2 mons -1 days' > > could be adjusted to '1 mons 29 days'. But unfortunately '2 mons -1 days' <> '1 mons 29 days' If I want something to happen 1 day less than two months from dome date, then the only way to say that consistently *is* '2 mons -1 days'. -------------- Hannu