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 15BE59DC821; Wed, 1 Mar 2006 16:27:50 -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 87267-04; Wed, 1 Mar 2006 16:27:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 9A7179DCBBE; Wed, 1 Mar 2006 16:27:47 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k21KRk423759; Wed, 1 Mar 2006 15:27:46 -0500 (EST) From: Bruce Momjian Message-Id: <200603012027.k21KRk423759@candle.pha.pa.us> Subject: Re: [SQL] Interval subtracting In-Reply-To: <1141244474.18820.12.camel@state.g2switchworks.com> To: Scott Marlowe Date: Wed, 1 Mar 2006 15:27:46 -0500 (EST) CC: Stephan Szabo , Tom Lane , "Milen A. Radev" , pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.411 required=5 tests=[AWL=-0.089, RAZOR2_CHECK=0.5] X-Spam-Score: 0.411 X-Spam-Level: X-Archive-Number: 200603/49 X-Sequence-Number: 80447 Scott Marlowe wrote: > 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) But it isn't '-2 months, -1 day'. I think what you are saying is what I am saying, that we should make the signs consistent. -- Bruce Momjian http://candle.pha.pa.us SRA OSS, Inc. http://www.sraoss.com + If your life is a hard drive, Christ can be your backup. +