Re: question about age()

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: question about age()
Date: 2013-08-30 07:43:53
Message-ID: 20130830074353.GA8364@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Andreas Kretschmer <akretschmer(at)spamfence(dot)net> writes:
> > '3 years' != '2 years 11 mons 30 days', but i got 0 rows, why?
>
> Well, actually:
>
> regression=# select '3 years'::interval = '2 years 11 mons 30 days'::interval;
> ?column?
> ----------
> t
> (1 row)
>
> IIRC, interval comparison operators normalize the two values assuming that
> 1 month = 30 days. Which is kind of arbitrary, but without some such
> assumption there's no way to have a scalar ordering of intervals at all.

Thanks, okay, make sense. I'm using extract() to extract and compare the
YEAR-field to spot a birthday from the age() ;-)

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mistina Michal 2013-08-30 08:14:53 pgpool-ha not found in yum postgres repository
Previous Message Jeff Davis 2013-08-30 01:23:09 Re: Why is NULL = unbounded for rangetypes?