Re: where'd the spaces come from

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: where'd the spaces come from
Дата
Msg-id 01b001c11c00$3ae2bbc0$1001a8c0@archonet.com
обсуждение исходный текст
Ответ на Re: where'd the spaces come from  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-sql
From: "Bruce Momjian" <pgman@candle.pha.pa.us>

> > Hi Bruce,
> >
> > a fix for what?
> > If you're meaning the leading space, then the fix is in the followup
post
> > that I made to my original quiestion. i.e.
> >
> > psql -c "select to_char(12,'xFM000');"
> >  to_char
> > ---------
> >  x012
> > (1 row)
> >
> > The 'FM' removes the space.
>
> So the FM is the correct way to do this, right?  There is no bug?

Well - it's certainly *unexpected* behaviour isn't it?

It is documented though (Karel Zak's given plenty of examples too):

"FM suppresses leading zeroes or trailing blanks that would otherwise be
added to make the output of a pattern be fixed-width"

Some of the examples show the difference too:

to_char(12,'9990999.9')   => ' 0012.0'
to_char(12,'FM9990999.9') => '0012'

I think the issue is you look at to_char() and make assumptions if you're
not familiar with it. I *seem* to remember someone saying Oracle worked this
way.

- Richard Huxton




В списке pgsql-sql по дате отправления:

Предыдущее
От: Christopher Sawtell
Дата:
Сообщение: Re: Activation of plsql
Следующее
От: Christopher Sawtell
Дата:
Сообщение: Re: Knowing new item in table...