pg_dump.create.language.patch

text/plain

Filename: pg_dump.create.language.patch
Type: text/plain
Part: 0
Message: pg_dump should not try CREATE OR REPLACE LANGUAGE < 9.0

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/bin/pg_dump/pg_dump.c 7 2
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 2431d71..c8f231c 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -7601,9 +7601,14 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang)
 		 * is a pg_pltemplate entry, and if there is one, the existing entry
 		 * must match it too.
 		 */
-		appendPQExpBuffer(defqry, "CREATE OR REPLACE PROCEDURAL LANGUAGE %s",
-						  qlanname);
+		if (g_fout->remoteVersion < 90000)
+			appendPQExpBuffer(defqry, "CREATE PROCEDURAL LANGUAGE %s",
+							  qlanname);
+		else
+			appendPQExpBuffer(defqry, "CREATE OR REPLACE PROCEDURAL LANGUAGE %s",
+							  qlanname);
 	}
+
 	appendPQExpBuffer(defqry, ";\n");
 
 	ArchiveEntry(fout, plang->dobj.catId, plang->dobj.dumpId,