Re: Bug 1500

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>, List pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug 1500
Date: 2005-03-27 19:43:53
Message-ID: 200503271143.53865.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-03-27 20:41:08 Re: Making oidvector and int2vector variable-length
Previous Message Alvaro Herrera 2005-03-27 19:42:39 Re: Making oidvector and int2vector variable-length