Re: Patch to add a primary key using an existing index - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Patch to add a primary key using an existing index
Date
Msg-id 21568.1295990040@sss.pgh.pa.us
Whole thread Raw
In response to Re: Patch to add a primary key using an existing index  (Gurjeet Singh <singh.gurjeet@gmail.com>)
Responses Re: Patch to add a primary key using an existing index  (Gurjeet Singh <singh.gurjeet@gmail.com>)
List pgsql-hackers
Gurjeet Singh <singh.gurjeet@gmail.com> writes:
> Attached is the updated patch with doc changes and test cases.

Applied with assorted corrections.  Aside from the refactoring I wanted,
there were various oversights.

> I have consciously disallowed the ability to specify storage_parameters
> using the WITH clause, if somebody thinks it is wise to allow that and is
> needed, I can do that.

AFAICS, WITH would be supplied at the time of index creation; it's not
appropriate to include it here, any more than INDEX TABLESPACE.

A point that may or may not have gotten discussed back when is that it's
important that the result of this process be dumpable by pg_dump, ie
there not be any hidden discrepancies between the state after ADD
CONSTRAINT USING INDEX and the state you'd get from straight ADD
CONSTRAINT, because the latter is the syntax pg_dump is going to emit.
ADD CONSTRAINT can handle WITH and INDEX TABLESPACE, so carrying those
over from the original index specification is no problem, but
non-default index opclasses or sort ordering options would be a big
problem.  That would in particular completely break pg_upgrade, because
the on-disk index wouldn't match the catalog entries created by running
pg_dump.  I added some code to check and disallow non-default opclass
and options.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: a regression
Next
From: David Fetter
Date:
Subject: Re: a regression