From: | "Joe Conway" <jconway2(at)home(dot)com> |
---|---|
To: | "Mark" <mark(at)zserve(dot)com>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Case Insensitive Queries |
Date: | 2001-05-29 16:54:39 |
Message-ID: | 005701c0e860$0d3d9ce0$dad410ac@jecw2k1 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> Is it possible to execute a query using a where clause that allows case
> insensitive comparison between a field and text.
>
> For example:
>
> select * from account where username = 'test'
>
> where username could be 'Test', which would be a match. As is, this
> compare is case sensitive.
>
You can use ~* (see 4.5.2. POSIX Regular Expressions
http://www.postgresql.org/idocs/index.php?functions-matching.html ) or force
everything to either upper or lower using the same named functions (see 4.4.
String Functions and Operators
http://www.postgresql.org/idocs/index.php?functions-string.html ). You can
build an index on upper(username) or lower(username), so that may be a good
choice if you don't really need a regular expression.
Hope this helps,
-- Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Dan Lyke | 2001-05-29 16:55:18 | Case Insensitive Queries |
Previous Message | Manessinger Andreas | 2001-05-29 16:53:13 | AW: Case Insensitive Queries |