X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 88322D1B233 for ; Fri, 16 Jul 2004 11:34:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67022-03 for ; Fri, 16 Jul 2004 14:34:08 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 73FDBD1B16A for ; Fri, 16 Jul 2004 11:34:04 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i6GEY8EW020679; Fri, 16 Jul 2004 10:34:08 -0400 (EDT) To: Theodore Petrosky Cc: Luis Sousa , pgsql-sql@postgresql.org Subject: Re: Problem in age on a dates interval In-reply-to: <20040716115215.29699.qmail@web41010.mail.yahoo.com> References: <20040716115215.29699.qmail@web41010.mail.yahoo.com> Comments: In-reply-to Theodore Petrosky message dated "Fri, 16 Jul 2004 04:52:14 -0700" Date: Fri, 16 Jul 2004 10:34:07 -0400 Message-ID: <20678.1089988447@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/99 X-Sequence-Number: 18351 Theodore Petrosky writes: > wow.... at first I thought I had my head around a leap > year problem so I advanced your query a year.... I think what's going on here is a difference of interpretation about whether an "M months D days" interval means to add the months first or the days first. For instance 2005-02-18 plus 2 months = 2005-04-18, plus 24 days = 2005-05-12 2005-02-18 plus 24 days = 2005-03-14, plus 2 months = 2005-05-14 The timestamp-plus-interval operator is evidently doing addition the first way, but it looks like age() is calculating the difference in a way that implicitly corresponds to the second way. I have some vague recollection that this has come up before, but I don't recall whether we concluded that age() needs to be changed or not. In any case it's not risen to the top of anyone's to-do list, because I see that age() still acts this way in CVS tip. regards, tom lane