Re: Unique index

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: Unique index
Дата
Msg-id g5p6dubjfljp4rnsabcfdiaswcs27xgppyn2gsr2f7mrmlpjze@3jfl43hbbn6p
обсуждение исходный текст
Ответ на Unique index  (Rajesh Kumar <rajeshkumar.dba09@gmail.com>)
Список pgsql-admin
On 2023-09-20 19:16 +0530, Rajesh Kumar wrote:
> Why unique index is used over unique constraints?

Is the question why someone might want to use a unique index instead of
a unique constraint?  The index can be functional, e.g.

    CREATE TABLE account (username text NOT NULL);
    CREATE UNIQUE INDEX account_lower_username_idx ON account (lower(username));

will make the username unique and case-insensitive (depending on the
collation and locale).

-- 
Erik



В списке pgsql-admin по дате отправления:

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: Unique index
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Unique index