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 F053A9DCC66; Wed, 1 Mar 2006 16:21:17 -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 85742-04; Wed, 1 Mar 2006 16:21:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 44C419DCC20; Wed, 1 Mar 2006 16:21:14 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Wed, 1 Mar 2006 20:21:14 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 01 Mar 2006 14:21:14 -0600 Subject: Re: [SQL] Interval subtracting From: Scott Marlowe 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 Content-Transfer-Encoding: 7bit Message-Id: <1141244474.18820.12.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 01 Mar 2006 14:21:14 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.151 required=5 tests=[AWL=0.150, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.151 X-Spam-Level: X-Archive-Number: 200603/47 X-Sequence-Number: 80445 On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote: > 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'. There's a part of me that thinks the WHOLE THING should be positive or negative: -(2 months 1 day)