pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
to_char adds leading space, intended?
2+ messages / 2 participants
[nested] [flat]

* to_char adds leading space, intended?
@ 2002-01-03 04:31  Aasmund Midttun Godal <postgresql@envisity.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Aasmund Midttun Godal @ 2002-01-03 04:31 UTC (permalink / raw)
  To: pgsql-sql

envisity=# SELECT '''' || to_char(1234, '099999') || '''';                           
 ?column?  
-----------
 ' 001234'
(1 row)

Is this the way it's meant to be?

I would prefer 
'001234'

So I don't have to ltrim it.
Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46



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

* Re: to_char adds leading space, intended?
@ 2002-01-03 07:39  rolf.ostvik@axxessit.no
  0 siblings, 0 replies; 2+ messages in thread

From: rolf.ostvik@axxessit.no @ 2002-01-03 07:39 UTC (permalink / raw)
  To: pgsql-sql


On 2002-01-03 "Aasmund Midttun Godal" <postgresql@envisity.com> wrote:
>envisity=# SELECT '''' || to_char(1234, '099999') || '''';

> ?column?
>-----------
> ' 001234'
>(1 row)

Modifier "FM" in the format string is your friend
     SELECT '''' || to_char(1234, 'FM099999') || '''';
                                    ^^

Table 4.11 on
     http://www.postgresql.org/idocs/index.php?functions-formatting.html
--
AXXESSIT ASA                  http://www.axxessit.no
Rolf Østvik / Test technician
Phone : (+47) 69 17 38 19     Fax: (+47) 69 17 39 00
P.O. Box 1053, Isebakkevn. 25, N-1787 Berg i Østfold





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


end of thread, other threads:[~2002-01-03 07:39 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-01-03 04:31 to_char adds leading space, intended? Aasmund Midttun Godal <postgresql@envisity.com>
2002-01-03 07:39 Re: to_char adds leading space, intended? rolf.ostvik@axxessit.no

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