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 DED819DCBD5 for ; Wed, 1 Mar 2006 16:28:44 -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 87518-02 for ; Wed, 1 Mar 2006 16:28:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A07AC9DCBBE for ; Wed, 1 Mar 2006 16:28:42 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k21KSB8n014835; Wed, 1 Mar 2006 15:28:11 -0500 (EST) To: Bruce Momjian cc: Mark Dilger , pgsql-hackers@postgresql.org Subject: Re: [SQL] Interval subtracting In-reply-to: <200603012013.k21KDFM21139@candle.pha.pa.us> References: <200603012013.k21KDFM21139@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Wed, 01 Mar 2006 15:13:15 -0500" Date: Wed, 01 Mar 2006 15:28:11 -0500 Message-ID: <14834.1141244891@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200603/50 X-Sequence-Number: 80448 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". regards, tom lane