Re: Bug 1500 - Mailing list pgsql-hackers

From Karel Zak
Subject Re: Bug 1500
Date
Msg-id 1111917832.2388.104.camel@petra
Whole thread Raw
In response to Re: Bug 1500  (Josh Berkus <josh@agliodbs.com>)
Responses Re: Bug 1500
List pgsql-hackers
On Sat, 2005-03-26 at 15:56 -0800, Josh Berkus wrote:
> Alvaro,
> 
> > On Sat, Mar 26, 2005 at 02:04:14PM -0800, Josh Berkus wrote:
> > > SELECT to_char( INTERVAL '43 hours 20 minutes', 'MI' ) || ' min';
> > > 2600 min
> >
> > Hmm, what if you wanted more than one literal string?  Say "1 mon 3
> > days" ... your concatenation idea wouldn't work.  ISTM the format string
> > should allow unconverted literals, so you would use
> >
> > SELECT to_char( INTERVAL '43 hours 20 minutes', 'MI min' );
> 
> Hmmm, good point.
> 
> Question: how does to_char tell the difference between a code ("MI") and a 
> code which is also part of a word? ("MIN").

It's pretty simple. to_char(..., 'MI "min"'). It's already supported by
to_char() format parser.

I think to_char(interval) should be support split interval to more
items, like:

to_char(INTERVAL '1d 3h 65s', 'HHh MIm SSs')  --->  '27h 1m 5s'

Well, I'm going to check how difficult will be implement correct to_char
(interval).
Karel

-- 
Karel Zak <zakkr@zf.jcu.cz>



pgsql-hackers by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: i want to find
Next
From: Karel Zak
Date:
Subject: Re: Bug 1500