Re: AGE function - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: AGE function
Date
Msg-id 20050907062634.GA14474@winnie.fuhr.org
Whole thread Raw
In response to AGE function  (Louise Catherine <r1c4n@yahoo.com>)
Responses Re: AGE function
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Louise Catherine
Date:
Subject: AGE function
Next
From: Louise Catherine
Date:
Subject: Re: AGE function