Обсуждение: Case sensitivity

Поиск
Список
Период
Сортировка

Case sensitivity

От
brichard@cafod.org.uk (Bruce Richardson)
Дата:
Discovering that text fields in Postgres are case sensitive - so "Text"
<> "text" and both can go into the same UNIQUE column - threw me a bit,
as this is different from other databases I've worked with.

Is there a toggle to turn off case sensitivity, either for a whole
database or for a column?  Or do I just have to get used to ~*?

--
Bruce

Re: Case sensitivity

От
Joel Burton
Дата:
On Tue, 27 Feb 2001, Bruce Richardson wrote:

> Discovering that text fields in Postgres are case sensitive - so "Text"
> <> "text" and both can go into the same UNIQUE column - threw me a bit,
> as this is different from other databases I've worked with.
>
> Is there a toggle to turn off case sensitivity, either for a whole
> database or for a column?  Or do I just have to get used to ~*?

No, you can't turn it off, and yes, many people do notice that it's not
the way some other databases work. (Some database make this configurable).

You can use ~*, you can also index on function results (eg, you can create
an index on a function. So, you could

  create unique index yourtable_pkey on yourtable ( upper(pkeyfield));

which would only allow one 'Joel', regardless of how you cap me.

--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


Re: Case sensitivity

От
"Oliver Elphick"
Дата:
Bruce Richardson wrote:
  >Discovering that text fields in Postgres are case sensitive - so "Text"
  ><> "text" and both can go into the same UNIQUE column - threw me a bit,
  >as this is different from other databases I've worked with.

Well, they are different, aren't they?

  >Is there a toggle to turn off case sensitivity, either for a whole
  >database or for a column?  Or do I just have to get used to ~*?

You can create a unique index on lower(column); ~* is very nice,
any way.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "If we confess our sins, he is faithful and just to
      forgive us our sins, and to cleanse us from all
      unrighteousness."       I John 1:9