Thread: Data Search

Data Search

From
Robert Hiltibidal
Date:
Howdy,

I'm try to do a search on users from one database against a table in another.

Both databases have a mixture of upper and lowercase characters. Is there a
way to tell postgres to consider a match if the absolute character is the
same regardless of case?

Ex 
'ROB' should also produce a hit if postgres encouters 'rob'

Thanks,

-Rob



Re: [INTERFACES] Data Search

From
Ed Loehr
Date:
> Both databases have a mixture of upper and lowercase characters. Is there a
> way to tell postgres to consider a match if the absolute character is the
> same regardless of case?
>
> Ex
> 'ROB' should also produce a hit if postgres encouters 'rob'
>

http://www.postgresql.org/docs/postgres/functions2470.htm

db=> create table t(s varchar);
CREATE
db=> insert into t values ('Joe');
INSERT 365513 1
db=> insert into t values ('JoE');
INSERT 365514 1
db=> insert into t values ('JOE');
INSERT 365515 1
db=> select * from t where s like 'joe';
s
-
(0 rows)

db=> select * from t where lower(s) like 'joe';
s
---
Joe
JoE
JOE
(3 rows)

Cheers,
Ed Loehr