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 474FC9DC821 for ; Wed, 1 Mar 2006 16:34:05 -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 88026-05 for ; Wed, 1 Mar 2006 16:34:05 -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 E08899DC9AF for ; Wed, 1 Mar 2006 16:34:02 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k21KXX125006; Wed, 1 Mar 2006 15:33:33 -0500 (EST) From: Bruce Momjian Message-Id: <200603012033.k21KXX125006@candle.pha.pa.us> Subject: Re: [SQL] Interval subtracting In-Reply-To: <14834.1141244891@sss.pgh.pa.us> To: Tom Lane Date: Wed, 1 Mar 2006 15:33:33 -0500 (EST) CC: Mark Dilger , 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/54 X-Sequence-Number: 80452 Tom Lane wrote: > Bruce Momjian writes: > > I don't think we can accept a change that takes a negative and turns it > > into a positive and negative. > > Yeah, I find the patch's changes to the regression results pretty > disturbing. > > Perhaps the correct definition ought to be like "if month part >= 0 > then the reduced day part should be between 0 and 30, otherwise the > reduced day part should be between 0 and -30". However there are > still corner cases to worry about. If the original month and day > parts are of different sign, you might not be able to do such a > reduction without changing the sign of the month part, consider > "1 month -95 days". Not clear what to do with this. > > I guess I would expect a good result to satisfy one of these three > cases: > * month > 0 and 0 <= day < 30 > * month < 0 and -30 < day <= 0 > * month = 0 and -30 < day < 30 > If you believe that then "1 month -95 days" should justify to > "-2 months -5 days". I believe 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. +