Re: Why do we allow indexes to contain the same column more than once?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why do we allow indexes to contain the same column more than once?
Дата
Msg-id 27528.1398953331@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Why do we allow indexes to contain the same column more than once?  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2014-05-01 13:55:46 +0100, Greg Stark wrote:
>> Is there some use case for that I'm not seeing?

> Can be useful if different opclasses are used for the individual
> columns. Other than that I am not seing much use.

Yeah.  This is more plausible for the advanced index types like GIST,
where different opclasses might possibly do significantly different
things.  We do prohibit it for unique/pkey constraints:

regression=# create table tt(f1 int, unique(f1,f1));
ERROR:  column "f1" appears twice in unique constraint
LINE 1: create table tt(f1 int, unique(f1,f1));                               ^

which I think is per SQL spec, and anyway there would be no way that
the constraint code would select different opclasses for the same column,
so it's clearly redundant.
        regards, tom lane



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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Successor of MD5 authentication, let's use SCRAM
Следующее
От: Tom Lane
Дата:
Сообщение: Re: quiet inline configure check misses a step for clang