From 9885206caba98bf0cb57d1c27d1a352c60c08496 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 13 May 2010 01:03:01 +0000
Subject: [PATCH] Move pg_upgrade shared library out into its own /contrib
 directory (pg_upgrade_support).

---
 contrib/Makefile                               |  3 ++-
 contrib/pg_upgrade/Makefile                    |  6 ------
 contrib/pg_upgrade/check.c                     |  6 +++---
 contrib/pg_upgrade/function.c                  | 14 +++++++-------
 contrib/pg_upgrade_support/Makefile            | 18 ++++++++++++++++++
 .../pg_upgrade_support.c}                      |  0
 doc/src/sgml/pgupgrade.sgml                    | 15 ++++++++-------
 7 files changed, 38 insertions(+), 24 deletions(-)
 create mode 100644 contrib/pg_upgrade_support/Makefile
 rename contrib/{pg_upgrade/pg_upgrade_sysoids.c => pg_upgrade_support/pg_upgrade_support.c} (100%)

diff --git a/contrib/Makefile b/contrib/Makefile
index c85a6526a01..56fa26cea29 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/contrib/Makefile,v 1.91 2010/05/12 16:50:58 tgl Exp $
+# $PostgreSQL: pgsql/contrib/Makefile,v 1.92 2010/05/13 01:03:00 momjian Exp $
 
 subdir = contrib
 top_builddir = ..
@@ -32,6 +32,7 @@ SUBDIRS = \
 		pg_stat_statements \
 		pg_trgm		\
 		pg_upgrade	\
+		pg_upgrade_support \
 		pgbench		\
 		pgcrypto	\
 		pgrowlocks	\
diff --git a/contrib/pg_upgrade/Makefile b/contrib/pg_upgrade/Makefile
index 870f3978929..c5ca04cf415 100644
--- a/contrib/pg_upgrade/Makefile
+++ b/contrib/pg_upgrade/Makefile
@@ -1,10 +1,6 @@
 #
 # Makefile for pg_upgrade
 #
-#	targets:	all, clean, install, uninstall 
-#
-# This Makefile generates an executable and a shared object file
-#
 
 PGFILEDESC = "pg_upgrade - an in-place binary upgrade utility"
 PGAPPICON = win32
@@ -14,8 +10,6 @@ OBJS = check.o controldata.o dump.o exec.o file.o function.o info.o \
        option.o page.o pg_upgrade.o relfilenode.o server.o \
        tablespace.o util.o version.o version_old_8_3.o $(WIN32RES)
 
-MODULES = pg_upgrade_sysoids
-
 PG_CPPFLAGS  = -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir)
 PG_LIBS = $(libpq_pgport)
 
diff --git a/contrib/pg_upgrade/check.c b/contrib/pg_upgrade/check.c
index bdf7fd6318f..9b2a3980825 100644
--- a/contrib/pg_upgrade/check.c
+++ b/contrib/pg_upgrade/check.c
@@ -232,15 +232,15 @@ check_cluster_compatibility(migratorContext *ctx, bool live_check)
 	FILE	   *lib_test;
 
 	/*
-	 * Test pg_upgrade_sysoids.so is in the proper place.	 We cannot copy it
+	 * Test pg_upgrade_support.so is in the proper place.	 We cannot copy it
 	 * ourselves because install directories are typically root-owned.
 	 */
-	snprintf(libfile, sizeof(libfile), "%s/pg_upgrade_sysoids%s", ctx->new.libpath,
+	snprintf(libfile, sizeof(libfile), "%s/pg_upgrade_support%s", ctx->new.libpath,
 			 DLSUFFIX);
 
 	if ((lib_test = fopen(libfile, "r")) == NULL)
 		pg_log(ctx, PG_FATAL,
-			   "\npg_upgrade%s must be created and installed in %s\n", DLSUFFIX, libfile);
+			   "\npg_upgrade_support%s must be created and installed in %s\n", DLSUFFIX, libfile);
 	else
 		fclose(lib_test);
 
diff --git a/contrib/pg_upgrade/function.c b/contrib/pg_upgrade/function.c
index a7a410adbec..dfe85ddf7df 100644
--- a/contrib/pg_upgrade/function.c
+++ b/contrib/pg_upgrade/function.c
@@ -42,43 +42,43 @@ install_support_functions(migratorContext *ctx)
 								  "CREATE OR REPLACE FUNCTION "
 					 "		binary_upgrade.set_next_pg_type_oid(OID) "
 								  "RETURNS VOID "
-								  "AS '$libdir/pg_upgrade_sysoids' "
+								  "AS '$libdir/pg_upgrade_support' "
 								  "LANGUAGE C STRICT;"));
 		PQclear(executeQueryOrDie(ctx, conn,
 								  "CREATE OR REPLACE FUNCTION "
 			   "		binary_upgrade.set_next_pg_type_array_oid(OID) "
 								  "RETURNS VOID "
-								  "AS '$libdir/pg_upgrade_sysoids' "
+								  "AS '$libdir/pg_upgrade_support' "
 								  "LANGUAGE C STRICT;"));
 		PQclear(executeQueryOrDie(ctx, conn,
 								  "CREATE OR REPLACE FUNCTION "
 			   "		binary_upgrade.set_next_pg_type_toast_oid(OID) "
 								  "RETURNS VOID "
-								  "AS '$libdir/pg_upgrade_sysoids' "
+								  "AS '$libdir/pg_upgrade_support' "
 								  "LANGUAGE C STRICT;"));
 		PQclear(executeQueryOrDie(ctx, conn,
 								  "CREATE OR REPLACE FUNCTION "
 				"		binary_upgrade.set_next_heap_relfilenode(OID) "
 								  "RETURNS VOID "
-								  "AS '$libdir/pg_upgrade_sysoids' "
+								  "AS '$libdir/pg_upgrade_support' "
 								  "LANGUAGE C STRICT;"));
 		PQclear(executeQueryOrDie(ctx, conn,
 								  "CREATE OR REPLACE FUNCTION "
 			   "		binary_upgrade.set_next_toast_relfilenode(OID) "
 								  "RETURNS VOID "
-								  "AS '$libdir/pg_upgrade_sysoids' "
+								  "AS '$libdir/pg_upgrade_support' "
 								  "LANGUAGE C STRICT;"));
 		PQclear(executeQueryOrDie(ctx, conn,
 								  "CREATE OR REPLACE FUNCTION "
 			   "		binary_upgrade.set_next_index_relfilenode(OID) "
 								  "RETURNS VOID "
-								  "AS '$libdir/pg_upgrade_sysoids' "
+								  "AS '$libdir/pg_upgrade_support' "
 								  "LANGUAGE C STRICT;"));
 		PQclear(executeQueryOrDie(ctx, conn,
 								  "CREATE OR REPLACE FUNCTION "
 			 "		binary_upgrade.add_pg_enum_label(OID, OID, NAME) "
 								  "RETURNS VOID "
-								  "AS '$libdir/pg_upgrade_sysoids' "
+								  "AS '$libdir/pg_upgrade_support' "
 								  "LANGUAGE C STRICT;"));
 		PQfinish(conn);
 	}
diff --git a/contrib/pg_upgrade_support/Makefile b/contrib/pg_upgrade_support/Makefile
new file mode 100644
index 00000000000..b844b8a61b0
--- /dev/null
+++ b/contrib/pg_upgrade_support/Makefile
@@ -0,0 +1,18 @@
+#
+# Makefile for pg_upgrade_support
+#
+
+PGFILEDESC = "pg_upgrade_support - shared library functions for pg_upgrade"
+
+MODULES = pg_upgrade_support
+
+ifdef USE_PGXS
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+else
+subdir = contrib/pg_upgrade
+top_builddir = ../..
+include $(top_builddir)/src/Makefile.global
+include $(top_srcdir)/contrib/contrib-global.mk
+endif
diff --git a/contrib/pg_upgrade/pg_upgrade_sysoids.c b/contrib/pg_upgrade_support/pg_upgrade_support.c
similarity index 100%
rename from contrib/pg_upgrade/pg_upgrade_sysoids.c
rename to contrib/pg_upgrade_support/pg_upgrade_support.c
diff --git a/doc/src/sgml/pgupgrade.sgml b/doc/src/sgml/pgupgrade.sgml
index 01919c64470..9392e98a97c 100644
--- a/doc/src/sgml/pgupgrade.sgml
+++ b/doc/src/sgml/pgupgrade.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/pgupgrade.sgml,v 1.1 2010/05/12 02:19:11 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/pgupgrade.sgml,v 1.2 2010/05/13 01:03:01 momjian Exp $ -->
 
 <sect1 id="pgupgrade">
  <title>pg_upgrade</title>
@@ -97,6 +97,13 @@ gmake prefix=/usr/local/pgsql.new install
     </para>
    </listitem>
  
+   <listitem>
+    <para>
+     Install <application>pg_upgrade</> and
+     <application>pg_upgrade_support</> in the new PostgreSQL cluster
+    </para>
+   </listitem>
+ 
    <listitem>
     <para>
      Initialize the new PostgreSQL cluster
@@ -123,12 +130,6 @@ gmake prefix=/usr/local/pgsql.new install
         delete the empty <literal>edb</> schema in the <literal>enterprisedb</> database
        </para>
       </listitem>
-      <listitem>
-       <para>
-        copy dbserver/lib/pgmemcache.so from the old server
-        to the new server (AS8.3 to AS8.3R2 migrations only)
-       </para>
-      </listitem>
      </itemizedlist>
     </para>
    </listitem>
-- 
GitLab