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 33CFB9DC821 for ; Wed, 1 Mar 2006 19:26:55 -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 32903-01 for ; Wed, 1 Mar 2006 19:26:57 -0400 (AST) 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 8DF2C9DC809 for ; Wed, 1 Mar 2006 19:26:51 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k21NQOv08610; Wed, 1 Mar 2006 18:26:24 -0500 (EST) From: Bruce Momjian Message-Id: <200603012326.k21NQOv08610@candle.pha.pa.us> Subject: Re: [SQL] Interval subtracting In-Reply-To: <440629DA.6050504@markdilger.com> To: Mark Dilger Date: Wed, 1 Mar 2006 18:26:24 -0500 (EST) CC: Tom Lane , 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.415 required=5 tests=[AWL=-0.085, RAZOR2_CHECK=0.5] X-Spam-Score: 0.415 X-Spam-Level: X-Archive-Number: 200603/85 X-Sequence-Number: 80483 Mark Dilger wrote: > Tom Lane wrote: > > Well, the question is whether justify_days has a sane definition that is > > different from this. Based on your example, I'm not seeing one. > > Backwards compatibility is probably more important than sanity. Let's just > deprecate the existing functions and recommend that people use > justify_interval(...). By not changing the existing functions we can avoid a > certain amount of hell. Those functions are new in 8.1 so I do think we can improve them in 8.2 if we agree. Tom's idea of: > * month > 0 and 0 <= day < 30 > * month < 0 and -30 < day <= 0 > * month = 0 and -30 < day < 30 seems a good change for 8.2, and the same for justify_hours(). The question is whether justify_days should also adjust hours I think is the issue, and the reason for a justify_interval() function. Even if we had people do: justify_hours(justify_days(justify_hours())) I don't think that would do what we want in all cases. Consider '1 mon -1 hour'. That should be '29 days 23 hours' but neither existing function, even if modified, will allow us to return that. Only something like justify_interval() could do it. -- 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. +