pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
function to_char
2+ messages / 2 participants
[nested] [flat]

* function to_char
@ 2021-04-17 15:03  Fontana Daniel C. (Desartec S.R.L.) <desartecsrl@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Fontana Daniel C. \(Desartec S.R.L.\) @ 2021-04-17 15:03 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

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?

 



-- 
El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
https://www.avast.com/antivirus

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: function to_char
@ 2021-04-17 15:09  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Fontana Daniel C. (Desartec S.R.L.) <desartecsrl@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-04-17 15:09 UTC (permalink / raw)
  To: Fontana Daniel C. \(Desartec S.R.L.\) <desartecsrl@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

"Fontana Daniel C. \(Desartec S.R.L.\)" <desartecsrl@gmail.com> writes:
> Example, select length (to_char (1, '990'))
> returns 4 because?

Per the fine manual:

    * If no explicit provision is made for a sign in to_char()'s pattern,
      one column will be reserved for the sign, and it will be anchored to
      (appear just left of) the number. If S appears just left of some
      9's, it will likewise be anchored to the number.

If you don't want to leave space for a sign, it looks like FM is
the only way to do that.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-04-17 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-04-17 15:03 function to_char Fontana Daniel C. (Desartec S.R.L.) <desartecsrl@gmail.com>
2021-04-17 15:09 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox