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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Patch to add a primary key using an existing index
Дата
Msg-id 28128.1295913673@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Patch to add a primary key using an existing index  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Patch to add a primary key using an existing index  (Robert Haas <robertmhaas@gmail.com>)
Re: Patch to add a primary key using an existing index  (Joshua Tolley <eggyknap@gmail.com>)
Re: Patch to add a primary key using an existing index  (Gurjeet Singh <singh.gurjeet@gmail.com>)
Список pgsql-hackers
I wrote:
> ... If that's the only issue then I don't see any need to wait on
> the author, so will take this one.

I find myself quite dissatisfied with the way that this patch adds yet
another bool flag to index_create (which has too many of those already),
with the effect of causing it to exactly *not* do an index creation.
That's a clear violation of the principle of least astonishment IMNSHO.
I think what's needed here is to refactor things a bit so that the
constraint-creation code is pulled out of index_create and called
separately where needed.  Hacking on that now.

One other issue that might be worthy of discussion is that as things
stand, execution of the ADD CONSTRAINT USING INDEX syntax will cause
the constraint to absorb the index as an INTERNAL dependency.  That
means dropping the constraint would make the index go away silently ---
it no longer has any separate life.  If the intent is just to provide a
way to get the effect of ALTER ADD PRIMARY KEY CONCURRENTLY, then this
behavior is probably fine.  But someone who believes DROP CONSTRAINT
exactly reverses the effects of ADD CONSTRAINT might be surprised.
Comments?
        regards, tom lane


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgindent and line length
Следующее
От: Noah Misch
Дата:
Сообщение: Re: ALTER TYPE 2: skip already-provable no-work rewrites