Re: to_char bug?

From: "Ben Trewern" <bendottrewern(at)mowlem(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: to_char bug?
Date: 2005-03-01 09:25:02
Message-ID: d01c8j$2d6t$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From the docs:

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

It works now but for one I don't understand why the space is added in the
firs place and two I think the docs don't tell the whole story ie leading
blanks and I assume trailing zeros if applicable.

Regards,

Ben

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote in message
news:794(dot)1109627049(at)sss(dot)pgh(dot)pa(dot)us(dot)(dot)(dot)
> "Ben Trewern" <bendottrewern(at)mowlem(dot)com> writes:
>> It seems that to_char(1, '000') gives a string " 001" with a space in
>> front.
>> Is this a bug?
>
> No.
>
> Possibly you want 'FM000'.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kai Hessing 2005-03-01 09:36:07 Re: Advanced SELECT
Previous Message Teodor Sigaev 2005-03-01 08:03:13 Re: multicolumn GIST index question