Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id BEBB89FB1E2; Fri, 6 Oct 2006 02:23:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 84289-06; Fri, 6 Oct 2006 02:23:24 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id AA0389FB3DA; Fri, 6 Oct 2006 02:23:17 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from webmail.enterprisedb.com (edb04.managed.contegix.com [63.246.7.176]) by svr4.postgresql.org (Postfix) with ESMTP id 2F7B95AF9D1; Fri, 6 Oct 2006 05:23:14 +0000 (GMT) Received: from [192.168.42.113] (natpool.bovine.net [67.100.216.14]) by webmail.enterprisedb.com (Postfix) with ESMTP id 15EEBA24E1E; Fri, 6 Oct 2006 00:23:13 -0500 (CDT) In-Reply-To: <21619.1160067054@sss.pgh.pa.us> References: <4522EC42.1080500@refractions.net> <21619.1160067054@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: gdavis@refractions.net, pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org Content-Transfer-Encoding: 7bit From: Jim Nasby Subject: Re: [HACKERS] timestamp subtraction (was Re: formatting intervals with to_char) Date: Thu, 5 Oct 2006 21:40:57 -0500 To: Tom Lane X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.115 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/76 X-Sequence-Number: 26465 On Oct 5, 2006, at 11:50 AM, Tom Lane wrote: > regression=# select ('2006-09-15 23:59:00'::timestamp - '2006-09-01 > 09:30:41'::timestamp); > ?column? > ------------------ > 14 days 14:28:19 > (1 row) > > should be reporting '350:28:19' instead. > > This is a hack that was done to minimize the changes in the regression > test expected outputs when we changed type interval from months/ > seconds > to months/days/seconds. But I wonder whether it wasn't a dumb idea. > It is certainly inconsistent, as noted in the code comments. > > I'm tempted to propose that we remove the justify_hours call, and tell > anyone who really wants the old results to apply justify_hours() to > the > subtraction result for themselves. Not sure what the fallout would > be, > though. I suspect there's applications out there that are relying on that being nicely formated for display purposes. I agree it should be removed, but we might need a form of backwards compatibility for a version or two... -- Jim Nasby jimn@enterprisedb.com EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)