Re: BUG #3723: dropping an index that doesn't refer to table's columns

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: BUG #3723: dropping an index that doesn't refer to table's columns
Дата
Msg-id 47307986.70409@enterprisedb.com
обсуждение исходный текст
Ответ на Re: BUG #3723: dropping an index that doesn't refer to table's columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #3723: dropping an index that doesn't refer to table's columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Tom Lane wrote:
> "Sam Mason" <sam@samason.me.uk> writes:
>> p.s. the reason for creating this strange index was to ensure that a maximum
>> of one row was inserted into the table---I can do this different ways for
>> now.
>
> Please explain how you thought it would help you do that, because
> without some evidence that there's a use-case, I'm inclined to fix it
> as above ...

Note that it was a unique index:

postgres=# CREATE TABLE silly (id integer);
CREATE TABLE
postgres=# CREATE UNIQUE INDEX i_silly ON silly ((1));
CREATE INDEX
postgres=# INSERT INTO silly VALUES (1);
INSERT 0 1
postgres=# INSERT INTO silly VALUES (2);
ERROR:  duplicate key value violates unique constraint "i_silly"

Not sure that's enough of a use case to justify not banning it...

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #3723: dropping an index that doesn't refer to table's columns
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #3723: dropping an index that doesn't refer to table's columns