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 E6E149DC809 for ; Wed, 1 Mar 2006 19:58:56 -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 36942-01 for ; Wed, 1 Mar 2006 19:58:59 -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 79CBA9DC821 for ; Wed, 1 Mar 2006 19:58:54 -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 k21NwPGN017318; Wed, 1 Mar 2006 18:58:25 -0500 (EST) To: Mark Dilger cc: Bruce Momjian , pgsql-hackers@postgresql.org Subject: Re: [SQL] Interval subtracting In-reply-to: <4406331A.6080307@markdilger.com> References: <200603012326.k21NQOv08610@candle.pha.pa.us> <4406331A.6080307@markdilger.com> Comments: In-reply-to Mark Dilger message dated "Wed, 01 Mar 2006 15:49:46 -0800" Date: Wed, 01 Mar 2006 18:58:25 -0500 Message-ID: <17317.1141257505@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/88 X-Sequence-Number: 80486 Mark Dilger writes: > justify_days(justify_hours(...)) fixes *everything* in the most recently > submitted patch, regardless of the convoluted case you invent. There is no data > for which it won't work. If so, one function or the other is cheating. Per discussion, justify_hours must never touch months, and I don't believe that justify_days should touch seconds either. The proposed justify_interval function should have a result different from successive application of the two existing functions, because it will ensure that all three fields have similar signs whereas separate use of the two functions can't promise that in corner cases. regards, tom lane