Re: Patch to add a primary key using an existing index

Поиск
Список
Период
Сортировка
От Itagaki Takahiro
Тема Re: Patch to add a primary key using an existing index
Дата
Msg-id AANLkTin04diTRki2iV9PHyKk_GHU0SSQ7-h5_OQBzS7u@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Patch to add a primary key using an existing index  (Steve Singer <ssinger@ca.afilias.info>)
Ответы Re: Patch to add a primary key using an existing index  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Fri, Nov 26, 2010 at 05:58, Steve Singer <ssinger@ca.afilias.info> wrote:
> The attached version of the patch gets your regression tests to pass.
> I'm going to mark this as ready for a committer.

I think we need more discussions about the syntax: ALTER TABLE table_name ADD PRIMARY KEY (...) WITH
(INDEX='index_name')

Issues:
* WITH (...) is designed for storage parameters. I think treating "INDEX" as a special keyword in the way might be
confusable.
* 'index_name' needs to be single-quoted, but object identifiers should be double-quoted literals in normal cases.
* The key specifier is a duplicated option because the index has own keys. Do we need it? It might be for safety, but
redundant.Note that the patch raises a reasonable error on conflict:
 
ERROR:  PRIMARY KEY/UNIQUE constraint definition does not match the index

And, I found a bug:
* USING INDEX TABLESPACE clause is silently ignored, even if the index uses another tablespace.

After all, do we need a special syntax for the functionality?
Reusing WITH (...) syntax seems to be a trouble for me.
"ADD PRIMARY KEY USING index_name" might be a candidate, but we'd
better reserve USING for non-btree PRIMARY KEY/UNIQUE indexes.
Ideas and suggestions?

-- 
Itagaki Takahiro


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: profiling connection overhead
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Assertion failure on hot standby