Re: where'd the spaces come from

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

> psql -c "select t.tregion || '/' || to_char(t.tnumber,'000') || '-' ||
> to_char(m.mnumber,'00') as unitno from teams t, members m
> where m.mteam = t.tid;"
>    unitno
> -------------
>  SW/ 041- 03
>  SW/ 041- 05

Looks like a buglet in to_char()s handling of numbers (unless I
misunderstand the way the formatting is supposed to work).

select '[' || to_char(12,'x000') || ']';?column?
----------[x 012]

If you're running the current version, might be worth posting a bug report.
You can work around it with something like:

... substr(to_char(t.tnumber,'000'),2,3) ...

HTH

- Richard Huxton



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

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: Re: where'd the spaces come from
Следующее
От: Gary Stainburn
Дата:
Сообщение: Possible problems with cyclic references