Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1A1B7475BA8 for ; Mon, 26 Aug 2002 08:46:17 -0400 (EDT) Received: from mta5.rcsntx.swbell.net (mta5.rcsntx.swbell.net [151.164.30.29]) by postgresql.org (Postfix) with ESMTP id A2BFD475B22 for ; Mon, 26 Aug 2002 08:46:16 -0400 (EDT) Received: from wwtsyyjjw ([216.61.64.88]) by mta5.rcsntx.swbell.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with SMTP id <0H1G00HN4BH79V@mta5.rcsntx.swbell.net> for pgsql-sql@postgresql.org; Mon, 26 Aug 2002 07:46:20 -0500 (CDT) Date: Mon, 26 Aug 2002 07:56:51 -0700 From: Jiaqing Wang Subject: Re: weird situation, BUG or I'm not doing it right In-reply-to: <20020825042730.GA6376@rice.edu> To: "Ross J. Reedstrom" Cc: pgsql-sql@postgresql.org Message-id: MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/351 X-Sequence-Number: 9197 Ross, You're exactly right, I re-created my table with text(may not seem elegant), the problem is solved. Thanks to all of your advice, I can now go on with my life with PostgreSQL. :) jjw 8/25/2002 -----Original Message----- From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Ross J. Reedstrom Sent: Saturday, August 24, 2002 9:28 PM To: Jiaqing Wang Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] weird situation, BUG or I'm not doing it right 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 ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org