Re: to_char bug?

From: Bricklen Anderson <BAnderson(at)PresiNET(dot)com>
To: Ben Trewern <bendottrewern(at)mowlem(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: to_char bug?
Date: 2005-02-28 17:19:26
Message-ID: 4223529E.5020501@PresiNET.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ben Trewern wrote:
> Is there any reason why :
>
> SELECT char_length(to_char(1, '000'));
>
> Gives a result
>
> char_length
> -------------
> 4
> (1 row)
>
> It seems that to_char(1, '000') gives a string " 001" with a space in front.
> Is this a bug?
>
> Regards,
>
> Ben
>
Try formatting the result:
SELECT char_length(to_char(1, 'fm000'));

char_length
-------------
3

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steffen Boehme 2005-02-28 17:26:36 Performance of Views
Previous Message Ken Johanson 2005-02-28 17:13:00 Re: Possible to run the server with ANSI/ISO string