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 3F9419DCB80; Wed, 1 Mar 2006 16:33:46 -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 86861-07; Wed, 1 Mar 2006 16:33:47 -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 B319E9DCBBE; Wed, 1 Mar 2006 16:33:43 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k21KXMc24967; Wed, 1 Mar 2006 15:33:22 -0500 (EST) From: Bruce Momjian Message-Id: <200603012033.k21KXMc24967@candle.pha.pa.us> Subject: Re: [SQL] Interval subtracting In-Reply-To: <1141244920.3737.10.camel@localhost.localdomain> To: Hannu Krosing Date: Wed, 1 Mar 2006 15:33:22 -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/53 X-Sequence-Number: 80451 Hannu Krosing wrote: > ?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'. Right, but you asked to justify the days by calling the function. -- 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. +