]> granicus.if.org Git - postgresql/commit
Fix ALTER EXTENSION / SET SCHEMA
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 31 Oct 2012 13:48:41 +0000 (10:48 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 31 Oct 2012 13:48:41 +0000 (10:48 -0300)
commitfb3590dde0fad43c2933afbdce699b9dd7d8ac53
tree783f52b52d9859ff469fe5859c405730a209a39b
parent7e951ba6e1de7bb77aef4ea2d0ef7d2be860f389
Fix ALTER EXTENSION / SET SCHEMA

In its original conception, it was leaving some objects into the old
schema, but without their proper pg_depend entries; this meant that the
old schema could be dropped, causing future pg_dump calls to fail on the
affected database.  This was originally reported by Jeff Frost as #6704;
there have been other complaints elsewhere that can probably be traced
to this bug.

To fix, be more consistent about altering a table's subsidiary objects
along the table itself; this requires some restructuring in how tables
are relocated when altering an extension -- hence the new
AlterTableNamespaceInternal routine which encapsulates it for both the
ALTER TABLE and the ALTER EXTENSION cases.

There was another bug lurking here, which was unmasked after fixing the
previous one: certain objects would be reached twice via the dependency
graph, and the second attempt to move them would cause the entire
operation to fail.  Per discussion, it seems the best fix for this is to
do more careful tracking of objects already moved: we now maintain a
list of moved objects, to avoid attempting to do it twice for the same
object.

Authors: Alvaro Herrera, Dimitri Fontaine
Reviewed by Tom Lane
src/backend/catalog/pg_constraint.c
src/backend/commands/alter.c
src/backend/commands/extension.c
src/backend/commands/tablecmds.c
src/backend/commands/typecmds.c
src/include/catalog/pg_constraint.h
src/include/commands/alter.h
src/include/commands/tablecmds.h
src/include/commands/typecmds.h