"Gavin Scott" <gavin@planetacetech.com> writes:
> If you rename a primary key, pg_dump tries to recreate it with the original
> name. Here is how to recreate:
>> CREATE TABLE foo ( id integer );
>> ALTER TABLE foo ADD CONSTRAINT foo_pkey PRIMARY KEY (id);
>> ALTER TABLE foo_pkey RENAME TO bar_pkey;
This is correct, as the controlling name is that of the constraint not
the index. We really should forbid the above entirely, but it's not
a very high-priority issue.
(Somewhat higher priority is to add a RENAME CONSTRAINT capability;
that's on the TODO list. There was a patch for this submitted recently
but it needs work...)
regards, tom lane