Re: question about age() - Mailing list pgsql-general

From Tom Lane
Subject Re: question about age()
Date
Msg-id 3976.1377808749@sss.pgh.pa.us
Whole thread Raw
In response to question about age()  (Andreas Kretschmer <akretschmer@spamfence.net>)
Responses Re: question about age()
List pgsql-general
Andreas Kretschmer <akretschmer@spamfence.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.

            regards, tom lane


pgsql-general by date:

Previous
From: Michael Nolan
Date:
Subject: Re: question about age()
Next
From: Jeff Davis
Date:
Subject: Re: Why is NULL = unbounded for rangetypes?