Re: pgsql: If an index depends on no columns of its table, give it a

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: pgsql: If an index depends on no columns of its table, give it a
Дата
Msg-id 1194600113.4251.368.camel@ebony.site
обсуждение исходный текст
Ответ на Re: pgsql: If an index depends on no columns of its table, give it a  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pgsql: If an index depends on no columns of its table, give it a
Список pgsql-committers
On Fri, 2007-11-09 at 04:05 -0500, Tom Lane wrote:
> Simon Riggs <simon@2ndquadrant.com> writes:
> > I had understood the discussion to conclude that indexes that do not
> > depend on any column of the table to not be allowed at all.
>
> That was my first reaction too, but the point about unique-index behavior
> refutes it.  Constraining a table to have at most one row is useful.

Sure is, and I've done it just a few days ago.

This SQL does it using standard syntax:

  create table foo (handle integer primary key check (handle = 1));

It's also a lot more obvious than creating an index on a constant, which
seems like a wrinkle that we should disallow. It just sounds to me like
something that will break again in the future, so I'd rather disallow it
now rather than here "but we need to support zero column indexes too".

--
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: If an index depends on no columns of its table, give it a
Следующее
От: petere@postgresql.org (Peter Eisentraut)
Дата:
Сообщение: pgsql: Allow XML processing instructions starting with "xml" while