pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Theodore Petrosky <tedpet5@yahoo.com>
Cc: Luis Sousa <llsousa@ualg.pt>
Cc: pgsql-sql@postgresql.org
Subject: Re: Problem in age on a dates interval
Date: Fri, 16 Jul 2004 10:34:07 -0400
Message-ID: <20678.1089988447@sss.pgh.pa.us> (raw)
In-Reply-To: <20040716115215.29699.qmail@web41010.mail.yahoo.com>
References: <20040716115215.29699.qmail@web41010.mail.yahoo.com>

Theodore Petrosky <tedpet5@yahoo.com> 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



view thread (6+ messages)  latest in thread

Message-ID: <20678.1089988447@sss.pgh.pa.us>
Permalink:  ../20678.1089988447@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20678.1089988447@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tedpet5@yahoo.com, llsousa@ualg.pt
  Subject: Re: Problem in age on a dates interval
  In-Reply-To: <20678.1089988447@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox