pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@rice.edu>
To: Jiaqing Wang <jjw72@swbell.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: weird situation, BUG or I'm not doing it right
Date: Sat, 24 Aug 2002 23:27:30 -0500
Message-ID: <20020825042730.GA6376@rice.edu> (raw)
In-Reply-To: <KCEJKHPEBJGGCDBEMMNKIEGCCBAA.jjw72@swbell.net>
References: <KCEJKHPEBJGGCDBEMMNKIEGCCBAA.jjw72@swbell.net>

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



view thread (5+ messages)  latest in thread

Message-ID: <20020825042730.GA6376@rice.edu>
Permalink:  ../20020825042730.GA6376@rice.edu/
Also on:    postgresql.org/message-id/20020825042730.GA6376@rice.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: reedstrm@rice.edu, jjw72@swbell.net
  Subject: Re: weird situation, BUG or I'm not doing it right
  In-Reply-To: <20020825042730.GA6376@rice.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox