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 B01DC9DC820 for ; Wed, 1 Mar 2006 14:24:49 -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 57465-02 for ; Wed, 1 Mar 2006 14:24:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 2A5069DC97D for ; Wed, 1 Mar 2006 14:24:43 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 800455646F; Wed, 1 Mar 2006 12:24:29 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 1 Mar 2006 12:24:28 -0600 Date: Wed, 1 Mar 2006 12:24:28 -0600 From: "Jim C. Nasby" To: Bruce Momjian Cc: Mark Dilger , Tom Lane , pgsql-hackers@postgresql.org Subject: Re: [SQL] Interval subtracting Message-ID: <20060301182428.GF82012@pervasive.com> References: <4405D445.4000200@markdilger.com> <200603011759.k21HxT320151@candle.pha.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200603011759.k21HxT320151@candle.pha.pa.us> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060301:pgman@candle.pha.pa.us::1ogV24mRZDbLpVx2:000000000000000 0000000000000000000000001HLJ X-Hashcash: 1:20:060301:pgsql@markdilger.com::lJEXg/6q8DGYC0UV:00000000000000000 00000000000000000000000008Jk X-Hashcash: 1:20:060301:tgl@sss.pgh.pa.us::zL7aJoG10sgL3Gdy:00000000000000000000 00000000000000000000000063B5 X-Hashcash: 1:20:060301:pgsql-hackers@postgresql.org::wBc6bgyh7fmGA2tv:000000000 0000000000000000000000003VQ8 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/34 X-Sequence-Number: 80432 On Wed, Mar 01, 2006 at 12:59:29PM -0500, Bruce Momjian wrote: > Good question. Should we restrict days to 0 - 30 or -30 - 30? The > current system does the later: > > test=> select justify_days('-45 days'); > justify_days > ------------------ > -1 mons -15 days > (1 row) > > test=> select justify_days('1 month -45 days'); > justify_days > -------------- > -15 days > (1 row) > > test=> select justify_days('1 month -15 days'); > justify_days > ---------------- > 1 mon -15 days > (1 row) > > Should we be adjusting the last one? I am unsure. Comments? ISTM it should be looking at the sign of the overall interval, and sticking with that consistently. So while '1 mon 5 days' and '-3 mon -8 days' both make sense, '1 mon -2 days' doesn't make nearly as much sense in the general case. Of course this is complicated by the fact that '1 mon 20 days' doesn't necessarily equate to '2 mon -10 days'... :( One of these days we should just create a new calendar. ;) -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461