From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
---|---|
To: | "Fontana Daniel C(dot) (Desartec S(dot)R(dot)L(dot))" <desartecsrl(at)gmail(dot)com> |
Cc: | pgadmin-support(at)lists(dot)postgresql(dot)org |
Subject: | Re: function to_char |
Date: | 2021-04-17 20:01:58 |
Message-ID: | CAECtzeW2ybh0okryWwPfHW36eKZ0kR1-Hy29g8zfV9RKm2MPTg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-support |
Hi,
Le sam. 17 avr. 2021 à 15:05, Fontana Daniel C. (Desartec S.R.L.) <
desartecsrl(at)gmail(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Fco Magalhães | 2021-04-18 13:48:26 | Pgadmin4 fail !!! |
Previous Message | Fontana Daniel C. (Desartec S.R.L.) | 2021-04-17 13:05:01 | function to_char |