diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
new file mode 100644
index afb28a8..a4ead5d
*** a/src/bin/pg_dump/pg_dump.c
--- b/src/bin/pg_dump/pg_dump.c
*************** dumpExtension(Archive *fout, ExtensionIn
*** 7331,7336 ****
--- 7331,7344 ----
  		int			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.
+ 		 */
+ 		appendPQExpBuffer(q, "DROP EXTENSION IF EXISTS %s;\n", qextname);
+ 
  		appendPQExpBuffer(q,
  						  "SELECT binary_upgrade.create_empty_extension(");
  		appendStringLiteralAH(q, extinfo->dobj.name, fout);
