Re: Re: Data type confusion - Mailing list pgsql-sql

From Tom Lane
Subject Re: Re: Data type confusion
Date
Msg-id 7596.997057901@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: Data type confusion  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Re: Data type confusion  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-sql
Peter Eisentraut <peter_e@gmx.net> writes:
> One day we will have to accept the fact that months and seconds must not
> be mixed, period.  You can have year/month intervals or
> day/hour/minute/second intervals, not a combination.  An interval of '5
> years 3 minutes' has no meaning with the natural calendar rules.

I don't agree --- five years and three minutes is perfectly meaningful.
There are only certain things you can validly do with it, however, and
scaling by a floating-point number isn't one of them, because fractional
months aren't well-defined.  But you can, for example, add it to or
subtract it from a timestamp to produce a well-defined result timestamp.

The real bogosity in the interval type is that months and seconds are
not sufficient: it should be months, days, and seconds.  As we get
reminded twice a year by the regression tests, "1 day" and "24 hours"
are not the same thing.
        regards, tom lane


pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Re: Data type confusion
Next
From: Peter Eisentraut
Date:
Subject: Re: Re: Data type confusion