Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6181147582E for ; Sun, 25 Aug 2002 00:27:26 -0400 (EDT) Received: from ece.rice.edu (ece.rice.edu [128.42.4.34]) by postgresql.org (Postfix) with ESMTP id E1A07475469 for ; Sun, 25 Aug 2002 00:27:25 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with ESMTP id 1AE6568A64; Sat, 24 Aug 2002 23:27:31 -0500 (CDT) Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154]) by ece.rice.edu (Postfix) with ESMTP id 5266568A5E; Sat, 24 Aug 2002 23:27:30 -0500 (CDT) Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.34 #1 (Debian)) id 17iozq-0001fE-00; Sat, 24 Aug 2002 23:27:30 -0500 Date: Sat, 24 Aug 2002 23:27:30 -0500 From: "Ross J. Reedstrom" To: Jiaqing Wang Cc: pgsql-sql@postgresql.org Subject: Re: weird situation, BUG or I'm not doing it right Message-ID: <20020825042730.GA6376@rice.edu> Mail-Followup-To: "Ross J. Reedstrom" , Jiaqing Wang , pgsql-sql@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.27i X-Virus-Scanned: by AMaViS snapshot-20020300 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/336 X-Sequence-Number: 9182 On Sat, Aug 24, 2002 at 10:56:31PM -0700, Jiaqing Wang wrote: > Hello, > > I found below situation weird, it seems to me a bug. > > backend=> select * from valid_addr where state_abrev=upper('pr'); > zip_code | city_name | state_abrev > ----------+-----------+------------- > (0 rows) > > while "select * from valid_addr where state_abrev='PR';" produces following > output > <20 lines of output> You left out the critical piece: what's the schema for the table valid_addr? I'll deduce that the column "state_abrev" is defined as something like 'char(4)'. It needs to be either char(2) (if _all_ state abbreviations are guarenteed to be only 2) or as text. fixed with char fields are padded with blanks. Not a bug, but an feature of the SQL standard. Ross