Fix pg_upgrade to handle extensions.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Feb 2011 00:17:33 +0000 (19:17 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Feb 2011 00:18:08 +0000 (19:18 -0500)
commitcaddcb8f4b96ce48b612e7c987ecde654d624616
tree36567671ef6c06350ca1d897fdc2ad49e8a5a7db
parent2e2d56fea97f43cf8c40a87143bc10356e4ed4d4
Fix pg_upgrade to handle extensions.

This follows my proposal of yesterday, namely that we try to recreate the
previous state of the extension exactly, instead of allowing CREATE
EXTENSION to run a SQL script that might create some entirely-incompatible
on-disk state.  In --binary-upgrade mode, pg_dump won't issue CREATE
EXTENSION at all, but instead uses a kluge function provided by
pg_upgrade_support to recreate the pg_extension row (and extension-level
pg_depend entries) without creating any member objects.  The member objects
are then restored in the same way as if they weren't members, in particular
using pg_upgrade's normal hacks to preserve OIDs that need to be preserved.
Then, for each member object, ALTER EXTENSION ADD is issued to recreate the
pg_depend entry that marks it as an extension member.

In passing, fix breakage in pg_upgrade's enum-type support: somebody didn't
fix it when the noise word VALUE got added to ALTER TYPE ADD.  Also,
rationalize parsetree representation of COMMENT ON DOMAIN and fix
get_object_address() to allow OBJECT_DOMAIN.
contrib/pg_upgrade/function.c
contrib/pg_upgrade_support/pg_upgrade_support.c
src/backend/catalog/objectaddress.c
src/backend/commands/comment.c
src/backend/commands/extension.c
src/backend/parser/gram.y
src/bin/pg_dump/common.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/include/commands/extension.h