Problem with upper() in select statement

From: John Cochran <jdc(at)fiawol(dot)org>
To: pgsql-general(at)hub(dot)org
Subject: Problem with upper() in select statement
Date: 2000-06-11 07:33:31
Message-ID: 200006110733.DAA63722@jdcochran.fiawol.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,

I'm having problems with what I believe to be a simple query and I assume
that either there is a bug in PostgreSQL in handling functions during a
select or I'm doing something very stupid.

I have a table of words and abbreviations where the word is being
used as a primary key. Everything in this table is stored in upper case
to make searches simple (don't have to worry about mixed case. Just convert
the word being searched for to upper and you're good to go).

Here is a simple sample session using psql to show the table structure
and two queries.

Why isn't the upper() function working in the first query?

Later,
John Cochran

----------------------------

bash-2.03$ psql dt
Welcome to psql, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

dt=> \d abbreviation
Table "abbreviation"
Attribute | Type | Modifier
-----------+----------+----------
word | char(15) | not null
abbr | char(4) |
Index: abbreviation_pkey

dt=> select * from abbreviation where word = upper('Boulevard');
word | abbr
------+------
(0 rows)

dt=> select * from abbreviation where word = 'BOULEVARD';
word | abbr
-----------------+------
BOULEVARD | BLVD
(1 row)

dt=> \q

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Yeoh 2000-06-12 02:03:12 Re: [GENERAL] Book nearing final form
Previous Message Marcos Barreto de Castro 2000-06-11 00:10:53 Cursor Problems