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 2E2C29DCC66; Wed, 1 Mar 2006 16:18:53 -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 84581-07; Wed, 1 Mar 2006 16:18:53 -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 5F9D39DCB80; Wed, 1 Mar 2006 16:18:48 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k21KIhi22006; Wed, 1 Mar 2006 15:18:43 -0500 (EST) From: Bruce Momjian Message-Id: <200603012018.k21KIhi22006@candle.pha.pa.us> Subject: Re: [SQL] Interval subtracting In-Reply-To: <20060218110129.W9818@megazone.bigpanda.com> To: Stephan Szabo Date: Wed, 1 Mar 2006 15:18:43 -0500 (EST) CC: 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.409 required=5 tests=[AWL=-0.091, RAZOR2_CHECK=0.5] X-Spam-Score: 0.409 X-Spam-Level: X-Archive-Number: 200603/46 X-Sequence-Number: 80444 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'. -- 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. +