Re: Postgres case insensitive searches - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Postgres case insensitive searches
Date
Msg-id F7C8C252-06DC-4E67-B189-20EFFB979F07@gmail.com
Whole thread Raw
In response to Re: Postgres case insensitive searches  (bhanu udaya <udayabhanu1984@hotmail.com>)
Responses Re: [pgadmin-support] Postgres case insensitive searches  (bhanu udaya <udayabhanu1984@hotmail.com>)
List pgsql-general
On Jun 29, 2013, at 3:59, bhanu udaya <udayabhanu1984@hotmail.com> wrote:

> Thanks. But, I do not want to convert into upper and show the result.

Why not? It won't modify your results, just the search condition:

SELECT id, val FROM t WHERE upper(val) LIKE 'AB%' ORDER BY val;

Or:

SELECT id, val FROM t WHERE upper(val) LIKE 'AB%' ORDER BY upper(val), val;


> Example, if I have records as below:
> id  type
> 1. abcd
> 2. Abcdef
> 3. ABcdefg
> 4. aaadf
>
> The below query should report all the above
>
> select * from table where type like 'ab%'. It should get all above 3 records.  Is there a way the database itself can
bemade case-insensitive with UTF8 characterset. I tried with character type & collation POSIX, but it did not really
help.

I was under the impression this would work, but ISTR that not every OS has this capability (Postgres makes use of the
OScollation mechanics). So, what OS are you running the server on? 

> > From: laurenz.albe@wien.gv.at
> > To: udayabhanu1984@hotmail.com; pgsql-general@postgresql.org
> > Subject: RE: Postgres case insensitive searches
> > Date: Fri, 28 Jun 2013 12:32:00 +0000

Please do not top-post on this list.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



pgsql-general by date:

Previous
From: Jeremy Palmer
Date:
Subject: Generate documentation from PL/pgsql source code?
Next
From: Vincent Veyron
Date:
Subject: Re: Application locking