From: "Bruce Momjian" <[EMAIL PROTECTED]>

> > Hi Bruce,
> >
> > a fix for what?
> > If you're meaning the leading space, then the fix is in the followup
post
> > that I made to my original quiestion. i.e.
> >
> > psql -c "select to_char(12,'xFM000');"
> >  to_char
> > ---------
> >  x012
> > (1 row)
> >
> > The 'FM' removes the space.
>
> So the FM is the correct way to do this, right?  There is no bug?

Well - it's certainly *unexpected* behaviour isn't it?

It is documented though (Karel Zak's given plenty of examples too):

"FM suppresses leading zeroes or trailing blanks that would otherwise be
added to make the output of a pattern be fixed-width"

Some of the examples show the difference too:

to_char(12,'9990999.9')   => ' 0012.0'
to_char(12,'FM9990999.9') => '0012'

I think the issue is you look at to_char() and make assumptions if you're
not familiar with it. I *seem* to remember someone saying Oracle worked this
way.

- Richard Huxton



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to