Re: Case Insensitive Queries

From: Mark <mark(at)zserve(dot)com>
To: ANDREW PERRIN <aperrin(at)email(dot)unc(dot)edu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Case Insensitive Queries
Date: 2001-05-29 16:21:15
Message-ID: 200105291713.f4THD3W09051@mail.ldssingles.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

We tried these but it didn't work. However, that's because username is
a bpchar and not a varchar, so its padded with blanks. so we tried
where lower(trim(username)) = 'test' and it works. We'll change that
column to varchar. The real problem was in the datatype for username.

Thanks,

On 29 May 2001 12:35:53 -0400, ANDREW PERRIN wrote:
> Try:
>
> - The ILIKE operator, for example,
>
> SELECT * FROM account WHERE username ILIKE "test";
>
> - upper() or lower(), for example,
>
> SELECT * FROM accont WHERE lower(username) = "test";
>
> ---------------------------------------------------------
> Andrew J. Perrin - Assistant Professor of Sociology
> University of North Carolina, Chapel Hill
> 269 Hamilton Hall CB#3210, Chapel Hill, NC 27599-3210 USA
> andrew_perrin(at)unc(dot)edu - http://www.unc.edu/~aperrin
>
> On 29 May 2001, Mark wrote:
>
> > 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.
> >
> > grep'd the source, but stricmp is only used for keywords and not actual
> > column data.
> >
> > Any help would be greatly appreciated.
> >
> > Thanks,
> >
> > Mark
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
> >
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David Lizano 2001-05-29 16:32:37 binary data
Previous Message tjk@tksoft.com 2001-05-29 15:23:52 Re: Case Insensitive Queries