Skip to content

Commit 3e00d33

Browse files
committed
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.
1 parent 0fc32c0 commit 3e00d33

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7331,6 +7331,16 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo)
73317331
int n;
73327332

73337333
appendPQExpBuffer(q, "-- For binary upgrade, create an empty extension and insert objects into it\n");
7334+
7335+
/*
7336+
* We unconditionally create the extension, so we must drop it if it
7337+
* exists. This could happen if the user deleted 'plpgsql' and then
7338+
* readded it, causing its oid to be greater than FirstNormalObjectId.
7339+
* The FirstNormalObjectId test was kept to avoid repeatedly dropping
7340+
* and recreating extensions like 'plpgsql'.
7341+
*/
7342+
appendPQExpBuffer(q, "DROP EXTENSION IF EXISTS %s;\n", qextname);
7343+
73347344
appendPQExpBuffer(q,
73357345
"SELECT binary_upgrade.create_empty_extension(");
73367346
appendStringLiteralAH(q, extinfo->dobj.name, fout);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy