Skip site navigation (1) Skip section navigation (2)

Re: Bug 1500

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: josh(at)agliodbs(dot)com
Cc: 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 10:03:52
Message-ID: 1111917832.2388.104.camel@petra (view raw or flat)
Thread:
Lists: 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(at)zf(dot)jcu(dot)cz>


In response to

Responses

pgsql-hackers by date

Next:From: Karel ZakDate: 2005-03-27 11:03:33
Subject: Re: Bug 1500
Previous:From: Michael FuhrDate: 2005-03-27 07:09:58
Subject: Re: i want to find

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group