Re: Bug 1500 - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: Bug 1500
Date
Msg-id 200503271143.53865.josh@agliodbs.com
Whole thread Raw
In response to Re: Bug 1500  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Bug 1500  (Karel Zak <zakkr@zf.jcu.cz>)
List pgsql-hackers
Tom, Karel,

> Hmm, if we want to support conversion like:
>       '43 hours 20 minutes' --> 'MI min'
> how we should work with calendar INTERVAL units? For example 'month'?
>       '1 month 1 day' --> 'D days'
> I think answer should be error message: "missing calendar unit 'month'
> in output format"

Actually, there's a pretty well-defined boundary within interval types:
year.month  |  day.hour.minute.second.millesecond

This subtype boundary of intervals is even defined in the SQL spec.

> Surely not.  to_char for timestamps doesn't require that you output
> every field of the value, and it shouldn't require that for intervals
> either.

That's an invalid comparison.  There is no logical way to "roll up" timestamps
into larger/smaller subtypes.  There is with intervals.

If you're arguing that this kink in the *useful* behavior of interval-->text
conversion is confusingly inconsistent with what to_char does with other data
types, and we should call the function something else, then I could
potentially buy that (assuming that others agree).   However, our proprietary
functions are about being *useful*, not adhering to some unwritten de-facto
standard.  And I am, as someone who uses intervals heavily in applications,
trying to define what the useful behaviour will be from a user's perspective.

--
Josh Berkus
Aglio Database Solutions
San Francisco


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Making oidvector and int2vector variable-length
Next
From: Tom Lane
Date:
Subject: Re: Making oidvector and int2vector variable-length