X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7FC8ED6E2C for ; Wed, 7 Sep 2005 03:26:41 -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 23068-05 for ; Wed, 7 Sep 2005 06:26:39 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 63421D80B1 for ; Wed, 7 Sep 2005 03:26:38 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j876QZ5x035513 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 7 Sep 2005 00:26:38 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j876QZdc014561; Wed, 7 Sep 2005 00:26:35 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j876QZ0E014560; Wed, 7 Sep 2005 00:26:35 -0600 (MDT) (envelope-from mfuhr) Date: Wed, 7 Sep 2005 00:26:34 -0600 From: Michael Fuhr To: Louise Catherine Cc: pgsql-sql@postgresql.org Subject: Re: AGE function Message-ID: <20050907062634.GA14474@winnie.fuhr.org> References: <20050907050506.55141.qmail@web33402.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050907050506.55141.qmail@web33402.mail.mud.yahoo.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200509/68 X-Sequence-Number: 22615 On Tue, Sep 06, 2005 at 10:05:06PM -0700, Louise Catherine wrote: > When I execute this statement : > select AGE(TO_DATE('20041101','yyyymmdd'), > TO_DATE('19991201','yyyymmdd')) > > at postgre 7.3.3, the result : > age > --------------------- > 4 years 11 mons 1 day > > at postgre 8.0.3, the result : > age > --------------- > 4 years 11 mons > > My question : > 1. How does postgre 7.3.3 calculate AGE function? > 2. Why the result produced by postgre 7.3.3 > is different from postgre 8.0.3 ? I get the same answer ("4 years 11 mons") in 7.2.8, 7.3.10, 7.4.8, 8.0.3, and 8.1beta1. Have you verified that to_date() is returning the correct dates? What are the results of the following queries on each of your systems? SELECT TO_DATE('19991201','yyyymmdd'), TO_TIMESTAMP('19991201','yyyymmdd'); SELECT TO_DATE('20041101','yyyymmdd'), TO_TIMESTAMP('20041101','yyyymmdd'); SHOW TimeZone; What operating system are you using? Prior to 8.0, PostgreSQL relied on the system's timezone files; as of 8.0 it has its own timezone database. I don't know if that matters, but it's one difference between 8.0 and previous versions that might be relevant to the problem. BTW, it's "PostgreSQL" or "Postgres," not "postgre." -- Michael Fuhr