Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 70712475498 for ; Thu, 8 Aug 2002 08:11:57 -0400 (EDT) Received: from ara.zf.jcu.cz (ara.zf.jcu.cz [160.217.161.4]) by postgresql.org (Postfix) with ESMTP id 48F3F47546C for ; Thu, 8 Aug 2002 08:11:56 -0400 (EDT) Received: from ara.zf.jcu.cz (localhost [127.0.0.1]) by ara.zf.jcu.cz (8.12.1/8.12.1/Debian -5) with ESMTP id g78CBtjc022370; Thu, 8 Aug 2002 14:11:55 +0200 Received: (from zakkr@localhost) by ara.zf.jcu.cz (8.12.1/8.12.1/Debian -5) id g78CBtww022369; Thu, 8 Aug 2002 14:11:55 +0200 Date: Thu, 8 Aug 2002 14:11:55 +0200 From: Karel Zak To: Ludwig Lim Cc: Frank Joerdens , PostgreSQL Mailing List Subject: Re: to_char and '=' weirdness Message-ID: <20020808141154.C14021@zf.jcu.cz> References: <20020808133300.A15630@superfly.archi-me-des.de> <20020808114824.4497.qmail@web40018.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020808114824.4497.qmail@web40018.mail.yahoo.com>; from lud_nowhere_man@yahoo.com on Thu, Aug 08, 2002 at 04:48:24AM -0700 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/146 X-Sequence-Number: 8992 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 :-) Karel -- Karel Zak http://home.zf.jcu.cz/~zakkr/ C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz