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 A10FE9DC822 for ; Wed, 1 Mar 2006 19:02:48 -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 28792-06 for ; Wed, 1 Mar 2006 19:02:50 -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 348619DC821 for ; Wed, 1 Mar 2006 19:02:45 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k21N2Hm04879; Wed, 1 Mar 2006 18:02:17 -0500 (EST) From: Bruce Momjian Message-Id: <200603012302.k21N2Hm04879@candle.pha.pa.us> Subject: Re: [SQL] Interval subtracting In-Reply-To: <16569.1141253147@sss.pgh.pa.us> To: Tom Lane Date: Wed, 1 Mar 2006 18:02:17 -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.415 required=5 tests=[AWL=-0.085, RAZOR2_CHECK=0.5] X-Spam-Score: 0.415 X-Spam-Level: X-Archive-Number: 200603/77 X-Sequence-Number: 80475 Tom Lane wrote: > Bruce Momjian writes: > > Imagine this: > > > '1 mons -2 days -12:00:00' > > > Which sign do we head to for this? For justify_hours, if we don't look > > at the months it remains unchange, but calling justify_days we get: > > > '28 days -12:00:00' > > > which is wrong (negative and positive). > > Ugh, that's not good. > > Based on that, I guess I have to change my vote: justify_hours should > still not look at the month (because it shouldn't use the month=30days > assumption), but justify_days should be changed to be effectively a > combination of both functions --- that is, it should fix all three > fields using both the 30days and the 24hours assumptions. Then it could > guarantee that all come out with the same sign. If we do that, we should just call it justify_interval(). I am thinking this is the direction to go, and for people who want more control they use the justify_hours and justify_days, and those are left unchanged. Should justify_days() look at hours only if the day and hours signs differ? And perhaps only if the hours is between -24 and 0. -- 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. +