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 D4C169DC9CF; Wed, 1 Mar 2006 16:33:02 -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 88076-04; Wed, 1 Mar 2006 16:33:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by postgresql.org (Postfix) with ESMTP id E2F1F9DC865; Wed, 1 Mar 2006 16:33:00 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 48B3D378C3; Wed, 1 Mar 2006 12:32:42 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 45987378A5; Wed, 1 Mar 2006 12:32:42 -0800 (PST) Date: Wed, 1 Mar 2006 12:32:42 -0800 (PST) From: Stephan Szabo To: Hannu Krosing Cc: Bruce Momjian , Tom Lane , "Milen A. Radev" , pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [SQL] Interval subtracting In-Reply-To: <1141244920.3737.10.camel@localhost.localdomain> Message-ID: <20060301123127.D11836@megazone.bigpanda.com> References: <200603012018.k21KIhi22006@candle.pha.pa.us> <1141244920.3737.10.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.138 required=5 tests=[AWL=0.138] X-Spam-Score: 0.138 X-Spam-Level: X-Archive-Number: 200603/52 X-Sequence-Number: 80450 On Wed, 1 Mar 2006, Hannu Krosing wrote: > =C3=9Chel kenal p=C3=A4eval, K, 2006-03-01 kell 15:18, kirjutas Bruce Mom= jian: > > 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 >=3D 3= 0 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 <=3D days < 30, not merely days < 30. > > > > > > What about cases like interval '1 month -99 days', should that turn i= nto > > > 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: > > > > =09'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 would you call justify_days on such an interval? '2 months -1 days' <> '1 mon 29 days', but '1 mon 60 days' is also <> '3 mons' in general usage.