Re: Making field non case sensitive

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Félix Sánchez Rodríguez <fesanch(at)ciego(dot)cult(dot)cu>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Making field non case sensitive
Date: 2009-04-05 15:53:46
Message-ID: dcc563d10904050853y30516722y2ee3208fe0dcbb5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

2009/4/5 Félix Sánchez Rodríguez <fesanch(at)ciego(dot)cult(dot)cu>:
> Greetings:
>
> I need to be able to establish which fields of my tables are and which are
> not case sensitive. Is it possible?? How??

In what way, in how you refer to them or in how you compare them?
PostgreSQL has no built in case-insensitive types, but there is an
addon for citext or something like it that makes a case insensitive
type. Or you can make a case insensitive index and use that.

create table mytable (id int, field x int, fieldy int, field1 text);
create index mytable_field1 on mytable ((lower(field)));
select * from mytable where lower(field)='abc';

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Toomas Vendelin 2009-04-06 06:28:01 COPY-ing ASCII file into UTF-8 database
Previous Message Pawel Socha 2009-04-05 15:29:28 Re: Making field non case sensitive