Re: Case Insensitive

From: Andy Anderson <aanderson(at)amherst(dot)edu>
To: PostgreSQL General Discussion Forum <pgsql-general(at)postgresql(dot)org>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Case Insensitive
Date: 2019-03-28 11:10:41
Message-ID: 7EF19AD1-94E8-4F8A-88E8-2F21B564AE2C@amherst.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Would this also select characters with diacritical marks? For example,

eid | ename
-----+-------
1 | aaa
2 | AAA
3 | áäâ
4 | āåȧ

— Andy

> On Mar 28, 2019, at 4:26 AM, Ben Madin <ben(at)ausvet(dot)com(dot)au> wrote:
>
> Or you can just use `ilike`:
>
> SELECT * FROM emp WHERE ename ilike 'aaa';
>
> https://www.postgresql.org/docs/10/sql-select.html#SQL-WHERE <https://www.postgresql.org/docs/10/sql-select.html#SQL-WHERE>
>
> cheers
>
> Ben
>
> On Thu, 28 Mar 2019 at 16:24, Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com <mailto:sameer(dot)kumar(at)ashnik(dot)com>> wrote:
>
>
> On Thu, 28 Mar, 2019, 4:20 PM Sridhar N Bamandlapally, <sridhar(dot)bn1(at)gmail(dot)com <mailto:sridhar(dot)bn1(at)gmail(dot)com>> wrote:
> Hi PG-General and Pgsql-Admin
>
> Can we achieve CASE INSENSITIVE in PostgreSQL?
>
> You are perhaps migrating from another RDBMS where this kind of feature is considered a feature.
>
>
>
> I mean, need below way
>
> postgres=# select * from emp;
> eid | ename
> -----+-------
> 1 | aaa
> 2 | AAA
> (2 rows)
>
>
> postgres=# select * from emp where ename='aaa';
> eid | ename
> -----+-------
> 1 | aaa
> 2 | AAA
> (2 rows)
> --above result is just an manual made example only
>
>
> You can write a query with upper function:
>
> select * from emp where upper(ename)=upper('aaa');
>
> Or you can overload the "=" operator for text arguements.
>
>
>
> Thanks
> Sridhar
>
>
>
> --
>
> <https://www.ausvet.com.au/>
>
> Dr Ben Madin BVMS MVPHMgmt PhD MANZCVS GAICD
> Managing Director
> Mobile: +61 448 887 220 <tel:+61448887220>
> E-mail: ben(at)ausvet(dot)com(dot)au <mailto:ben(at)ausvet(dot)com(dot)au>
> Website: www.ausvet.com.au <https://www.ausvet.com.au/>
> Skype: benmadin <>
> Address: 5 Shuffrey Street
> Fremantle, WA 6160
> Australia

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Andreas Kretschmer 2019-03-28 11:28:53 Re: Case Insensitive
Previous Message Holger Jakobs 2019-03-28 11:01:07 Re: Case Insensitive

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2019-03-28 11:28:53 Re: Case Insensitive
Previous Message Holger Jakobs 2019-03-28 11:01:07 Re: Case Insensitive