Re: to_char and '=' weirdness

From: Frank Joerdens <frank(at)joerdens(dot)de>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com>, Frank Joerdens <frank(at)joerdens(dot)de>, PostgreSQL Mailing List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: to_char and '=' weirdness
Date: 2002-08-08 12:46:47
Message-ID: 20020808144646.B15630@superfly.archi-me-des.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Aug 08, 2002 at 02:11:55PM +0200, Karel Zak wrote:
> On Thu, Aug 08, 2002 at 04:48:24AM -0700, Ludwig Lim wrote:
> >
> > > which would appear to indicate that to_char actually
> > > yields the string
> > > '04109'. Why doesn't the '=' operator work then?
> >
> > I tried running a test sql statement
> > select(length(to_char(99,'00000')))
> > It return six.
> >
> > I think that postgreSQL put a leading blank to
> > indicate that it is a positive number (not sure, just
> > my opinion)
>
> Right.
>
> > try using :
> >
> > select to_char(plz,'00000')
> > from andresses
> > where trim(to_char(plz,'00000'))='04109'
>
> use FM instead trim(): to_char(plz,'FM00000')
>
> ...and please, better read docs :-)

Well, I just looked again and couldn't find it. Mostly I use Bruce's
excellent book (pdf version from November 2000), which at least mentions
to_char. I just went to

http://www.de.postgresql.org/users-lounge/docs/7.2/postgres/

and looked under data types and type conversion, to no avail.

Where is this documented?

Regards, Frank

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Frank Joerdens 2002-08-08 13:04:56 Re: to_char and '=' weirdness
Previous Message Karel Zak 2002-08-08 12:11:55 Re: to_char and '=' weirdness