Re: Re: Problems with avg on interval data type

Peter Eisentraut <peter_e@gmx.net>

From: Peter Eisentraut <peter_e@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: <lockhart@fourpalms.org>, <jeremy@horizonlive.com>, <pgsql-bugs@postgresql.org>, Hackers List <pgsql-hackers@postgresql.org>
Date: 2001-05-19T00:55:12Z
Lists: pgsql-bugs, pgsql-hackers
Tom Lane writes:

> I suggest that the current code is more correct than you think ;-).
> ISTM it is a good idea to require a units field, or at least some
> punctuation giving a clue about units --- for example I do not object to
> '08:00' being interpreted as hours and minutes.  But I would be inclined
> to reject all four of the forms '+8', '-8', '8.0', and '8' as ambiguous.
> Is there something in the SQL spec that requires us to accept them?

Our interval is quite a bit different from the SQL version.  In SQL, an
interval value looks like this:

INTERVAL -'5 12:30:15.3' DAY TO SECOND

The unit qualifier is required.  Consequentially, I would reject anything
without units, except '0' maybe.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter