Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 30F354758F7 for ; Thu, 8 Aug 2002 08:46:49 -0400 (EDT) Received: from superfly.archi-me-des.de (unknown [62.8.212.177]) by postgresql.org (Postfix) with ESMTP id 259EA47546C for ; Thu, 8 Aug 2002 08:46:48 -0400 (EDT) Received: (from frank@localhost) by superfly.archi-me-des.de (8.9.3/8.9.3) id OAA16520; Thu, 8 Aug 2002 14:46:47 +0200 Date: Thu, 8 Aug 2002 14:46:47 +0200 From: Frank Joerdens To: Karel Zak Cc: Ludwig Lim , Frank Joerdens , PostgreSQL Mailing List Subject: Re: to_char and '=' weirdness Message-ID: <20020808144646.B15630@superfly.archi-me-des.de> References: <20020808133300.A15630@superfly.archi-me-des.de> <20020808114824.4497.qmail@web40018.mail.yahoo.com> <20020808141154.C14021@zf.jcu.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.1.2i In-Reply-To: <20020808141154.C14021@zf.jcu.cz>; from zakkr@zf.jcu.cz on Thu, Aug 08, 2002 at 02:11:55PM +0200 X-Subliminal-Message: Use Linux! Use Linux! X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/147 X-Sequence-Number: 8993 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