Select * from users WHERE upper(lastName) = upper('Pringle')

From: "Hale Pringle" <halepringle(at)yahoo(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Select * from users WHERE upper(lastName) = upper('Pringle')
Date: 2003-01-10 23:45:43
Message-ID: HIEOJHJBFLIEMFCAOMOEIEMCCIAA.halepringle@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-sql

I have notices that when you want to use the upper() function, you must also
use the trim().

For example,
In a situation where a column names lastname is char(40):
SELECT * FROM users WHERE lastname = 'Pringle' returns one row.

SELECT * FROM users WHERE UPPER(lastname) = UPPER('Pringle') will return
zero rows.

SELECT * FROM users WHERE TRIM(UPPER(lastname) = TRIM(UPPER('Pringle'))
will return one row.

This seems odd to me. Can someone explain?

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Warren Little 2003-01-11 00:23:19 repeating message in Postgres logs
Previous Message Rhett Sutphin 2003-01-10 20:58:51 Truncation bug when retrieving timestamps with fractional seconds (PG 7.3)

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2003-01-11 18:45:11 Re: Getting sequence value after inserting many rows at a time
Previous Message Josh Berkus 2003-01-10 22:26:49 Re: function does not exist