Re: Statistical Lacunae in Interval type - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Statistical Lacunae in Interval type
Date
Msg-id 24447.1089645034@sss.pgh.pa.us
Whole thread Raw
In response to Re: Statistical Lacunae in Interval type  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Statistical Lacunae in Interval type
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> The problem is that an interval datum already implies the units, so in 
> order to allow interval * interval we would have to add a new type 
> "interval squared", which would probably be considered to be a bit 
> foolish.

Not only foolish but complicated.  Remember that interval internally
is "N months plus X seconds" (where N is integral but X needn't be).
To avoid losing information, a product datatype would have to look
something like "N months-squared plus X months-seconds plus Y
seconds-squared", which offers no intuition whatever about how to
operate on it.  I doubt there's even a unique way to define
square-rooting this.

Add on top the fact that we really need to change interval to be
"M months plus N days plus X seconds" to solve the ever-popular
daylight-savings-transition issues, and a product datatype would
get out of hand altogether.

When I said "mash it down to seconds first", I was speaking very
literally...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Statistical Lacunae in Interval type
Next
From: David Fetter
Date:
Subject: Re: Statistical Lacunae in Interval type