Re: function to_char - Mailing list pgadmin-support

From Guillaume Lelarge
Subject Re: function to_char
Date
Msg-id CAECtzeW2ybh0okryWwPfHW36eKZ0kR1-Hy29g8zfV9RKm2MPTg@mail.gmail.com
Whole thread Raw
In response to function to_char  ("Fontana Daniel C. \(Desartec S.R.L.\)" <desartecsrl@gmail.com>)
List 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 by date:

Previous
From: "Fontana Daniel C. \(Desartec S.R.L.\)"
Date:
Subject: function to_char
Next
From: Fco Magalhães
Date:
Subject: Pgadmin4 fail !!!