Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9X6F-00052N-TB for pgsql-general@arkaria.postgresql.org; Thu, 28 Mar 2019 15:37:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h9X6E-0004uG-K0 for pgsql-general@arkaria.postgresql.org; Thu, 28 Mar 2019 15:37:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9X6E-0004p4-7n; Thu, 28 Mar 2019 15:37:50 +0000 Received: from mail-yb1-xb41.google.com ([2607:f8b0:4864:20::b41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9X6B-0001nD-Ky; Thu, 28 Mar 2019 15:37:49 +0000 Received: by mail-yb1-xb41.google.com with SMTP id x79so245804ybg.2; Thu, 28 Mar 2019 08:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TnE+iTfMZMtTHguyvspO5ABcgUhL8UHhL+rqRvgzgpU=; b=pHQXouAhjnLbAP98ECrEWH2IAQG6Z/eWQ7V+BSJmfa7EtIkSRSjUTmEGvmKGPX/nLY Fj4NKZyx9tXlQiowMRGuXfTCKBgNJbvA0aIK5nhYcncDyqPTl1ndvDTUQjlJeXODHmmD 2RwuWCDrGUWimhzMLCZPvPuhwQEqLRwgk+bDU6tLwxvn1r0MFMi6vc44cyFfxMStcEoJ kgmDPEgIpRf5rL+6qNKG91k6QSKFgt7EAfXHfs9gpjgHAPe9iui3VZnDYRbZDaqd2Vtc iYAgGwMoBjj6JRXtU06ACe7F6c82PfsZnlRy2Yix0DVAuDLk1fogYnaapwrgu95iywLo 2ynw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TnE+iTfMZMtTHguyvspO5ABcgUhL8UHhL+rqRvgzgpU=; b=bCWPMXGiWT2S7jedlyg58oErbya9KfHiiFBEK8vhYN9Avyo2d2rNKQyclP2cDyhm5T HSKyUsR9tl2EwDV2040YOBwt0RMnU/vt3oYnm5zv9zw9LpqV2IypBtNEbehC12YuoUAa iaBdb3DyD7M+7R10pVyzCwGrA1LDxzkODXphoIcSOGKbX+iTL4tjaC/LE4WaOpp8F88B doVN6ZERFbcthNNqQrePWoISdaR8O7q04Mv/N7SIlH2uGqiHvW0y1A/GIu/IdLBL56jc 6DiUKus8hjvkUNjLkHRj+CZBNfUfgQsw0spqOzr8W6fRroMiPWxsSHvxP/QXCgV4sg23 I8oQ== X-Gm-Message-State: APjAAAXyFELGBAbNV3A+/7BbMyRPeeBAEI6DPkA8s5tUzOUkqKkkhQtl Zt6kudqWc1jhB5ACFwt3GO0qhqy0Vz+cZIgqZ6s= X-Google-Smtp-Source: APXvYqwjL9zzfCY7hYWZNb8JtFume/BPPFNCSa1gX2uP24t+09WpRP+arGJMTazh4uDS0QAgLfSKJkZolhagHHPGphk= X-Received: by 2002:a25:3187:: with SMTP id x129mr34649940ybx.315.1553787465837; Thu, 28 Mar 2019 08:37:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shreeyansh Dba Date: Thu, 28 Mar 2019 21:07:33 +0530 Message-ID: Subject: Re: Case Insensitive To: Sridhar N Bamandlapally Cc: PG-General Mailing List , pgsql-admin Content-Type: multipart/alternative; boundary="000000000000f530ec0585295516" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000f530ec0585295516 Content-Type: text/plain; charset="UTF-8" Hi Sridhar, There are a few workarounds available, hope this will help you. 1) Use the citext extension 2) Use ILIKE instead of LIKE 3) Use Postgres lower() function 4) Add an index on lower(ename) Thanks & Regards, *Shreeyansh DBA Team* www.shreeyansh.com On Thu, Mar 28, 2019 at 1:50 PM Sridhar N Bamandlapally < sridhar.bn1@gmail.com> wrote: > Hi PG-General and Pgsql-Admin > > Can we achieve CASE INSENSITIVE in PostgreSQL? > > 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* > > > Thanks > Sridhar > > --000000000000f530ec0585295516 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Sridhar,

There are a few workarounds available, hope this will help you.

1) Use the citext extension
2) U= se ILIKE instead of LIKE
3) Use Postgres lower() function
4) Add an i= ndex on lower(ename)

Thank= s & Regards,
Shreeyansh DBA Team
www.shreeyansh.com
=


On Thu, Mar 28, 2019 at 1:50 PM Sri= dhar N Bamandlapally <sridhar.b= n1@gmail.com> wrote:
Hi=C2=A0PG-General and Pgsql-= Admin

Can we achieve CASE INSENSITIVE in PostgreSQL?

I mean, need below way

postgres=3D# select * from emp;
=C2=A0eid | ename
-----+-------
=C2=A0 =C2=A02 | AAA
= (2 rows)


postgres=3D# select * from emp where ename= =3D'aaa';
=C2=A0eid | ename
-----+-------
=C2=A0 =C2=A01 | aaa
=C2=A0 =C2=A02 | AAA
(2 rows)
--above result is just an manual made example only=


Thanks
Sridhar

--000000000000f530ec0585295516--