Re: Partial Indices vs. mixing columns and functions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Partial Indices vs. mixing columns and functions
Дата
Msg-id 16502.995307688@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Partial Indices vs. mixing columns and functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Mike Mascari <mascarm@mascari.com> writes:
>> Or will Martijn van Oosterhout's new Partial Indices work allow me to
>> create a unique index like:
>> CREATE UNIQUE INDEX i_foo ON foo(value)
>> WHERE deactive IS NULL;

Just for the record: with CVS tip,

regression=# create table foo(value int, deactive int);
CREATE
regression=# CREATE UNIQUE INDEX i_foo ON foo(value)
regression-#  WHERE deactive IS NULL;
CREATE
regression=# insert into foo values (1,2);
INSERT 146307 1
regression=# insert into foo values (1,2);
INSERT 146308 1
regression=# insert into foo values (1,null);
INSERT 146309 1
regression=# insert into foo values (1,null);
ERROR:  Cannot insert a duplicate key into unique index i_foo
regression=# insert into foo values (2,null);
INSERT 146311 1
regression=# insert into foo values (2,null);
ERROR:  Cannot insert a duplicate key into unique index i_foo
regression=#

            regards, tom lane

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

Предыдущее
От: "Richard Huxton"
Дата:
Сообщение: Re: html to postgres...
Следующее
От: Tony Grant
Дата:
Сообщение: Re: html to postgres...