mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Have pg_dump in binary-upgrade mode properly drop user-created
extensions that might exist in the new empty cluster databases, like plpgsql. Backpatch to 9.2.
This commit is contained in:
parent
0fc32c00d7
commit
3e00d33261
@ -7331,6 +7331,16 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
appendPQExpBuffer(q, "-- For binary upgrade, create an empty extension and insert objects into it\n");
|
appendPQExpBuffer(q, "-- For binary upgrade, create an empty extension and insert objects into it\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We unconditionally create the extension, so we must drop it if it
|
||||||
|
* exists. This could happen if the user deleted 'plpgsql' and then
|
||||||
|
* readded it, causing its oid to be greater than FirstNormalObjectId.
|
||||||
|
* The FirstNormalObjectId test was kept to avoid repeatedly dropping
|
||||||
|
* and recreating extensions like 'plpgsql'.
|
||||||
|
*/
|
||||||
|
appendPQExpBuffer(q, "DROP EXTENSION IF EXISTS %s;\n", qextname);
|
||||||
|
|
||||||
appendPQExpBuffer(q,
|
appendPQExpBuffer(q,
|
||||||
"SELECT binary_upgrade.create_empty_extension(");
|
"SELECT binary_upgrade.create_empty_extension(");
|
||||||
appendStringLiteralAH(q, extinfo->dobj.name, fout);
|
appendStringLiteralAH(q, extinfo->dobj.name, fout);
|
||||||
|
Loading…
Reference in New Issue
Block a user