Re: Patch to add a primary key using an existing index
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gurjeet Singh <singh.gurjeet@gmail.com>
Cc: PGSQL Hackers <pgsql-hackers@postgresql.org>, Peter Eisentraut <peter_e@gmx.net>, Robert Haas <robertmhaas@gmail.com>, r t <pgsql@xzilla.net>, Itagaki Takahiro <itagaki.takahiro@gmail.com>, Steve Singer <ssinger@ca.afilias.info>, Steve Singer <ssinger_pg@sympatico.ca>
Date: 2011-01-25T21:14:00Z
Lists: 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