Re: function to_char

Поиск
Список
Период
Сортировка
От Guillaume Lelarge
Тема Re: function to_char
Дата
Msg-id CAECtzeW2ybh0okryWwPfHW36eKZ0kR1-Hy29g8zfV9RKm2MPTg@mail.gmail.com
обсуждение исходный текст
Ответ на function to_char  ("Fontana Daniel C. \(Desartec S.R.L.\)" <desartecsrl@gmail.com>)
Список pgadmin-support
Hi,

Le sam. 17 avr. 2021 à 15:05, Fontana Daniel C. (Desartec S.R.L.) <desartecsrl@gmail.com> a écrit :

Hi, using postgres 12.5.

 

The to_char function has a problem with format length.

 

Example, select length (to_char (1, '990'))

 

returns 4 because?

 

if the format has length 3?

 


Actually, the format length isn't 3. It is 4 because you need one character to put the sign when needed.

postgres=# select '<'||to_char (+999, '990')||'>';
 ?column?
----------
 < 999>
(1 row)

postgres=# select '<'||to_char (-999, '990')||'>';
 ?column?
----------
 <-999>
(1 row)


--
Guillaume.

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

Предыдущее
От: "Fontana Daniel C. \(Desartec S.R.L.\)"
Дата:
Сообщение: function to_char
Следующее
От: Fco Magalhães
Дата:
Сообщение: Pgadmin4 fail !!!