diff options
author | Bruce Momjian <bruce@momjian.us> | 2012-03-19 09:31:50 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2012-03-19 09:31:50 -0400 |
commit | 28155746150f584e8147e2e3f68fec8c0d819cbf (patch) | |
tree | ba982cc0fab65d39921dda052715fcd77e436ddb /contrib/pg_upgrade/function.c | |
parent | ed79eddba9367f1e35e480e87cbaafc18b9f75ca (diff) |
In pg_upgrade, remove dependency on pg_config, as that might not be in
the non-development install. Instead, use the LOAD mechanism to check
for the pg_upgrade_support shared object, like we do for other shared
object checks.
Backpatch to 9.1.
Report from Àlvaro
Diffstat (limited to 'contrib/pg_upgrade/function.c')
-rw-r--r-- | contrib/pg_upgrade/function.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/contrib/pg_upgrade/function.c b/contrib/pg_upgrade/function.c index 4878ded6615..6547e58e11a 100644 --- a/contrib/pg_upgrade/function.c +++ b/contrib/pg_upgrade/function.c @@ -11,6 +11,7 @@ #include "access/transam.h" +#define PG_UPGRADE_SUPPORT "$libdir/pg_upgrade_support" /* * install_support_functions_in_new_db() @@ -153,17 +154,17 @@ get_loadable_libraries(void) PQfinish(conn); } + totaltups++; /* reserve for pg_upgrade_support */ + /* Allocate what's certainly enough space */ - if (totaltups > 0) - os_info.libraries = (char **) pg_malloc(totaltups * sizeof(char *)); - else - os_info.libraries = NULL; + os_info.libraries = (char **) pg_malloc(totaltups * sizeof(char *)); /* * Now remove duplicates across DBs. This is pretty inefficient code, but * there probably aren't enough entries to matter. */ totaltups = 0; + os_info.libraries[totaltups++] = pg_strdup(PG_UPGRADE_SUPPORT); for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++) { @@ -252,6 +253,12 @@ check_loadable_libraries(void) if (PQresultStatus(res) != PGRES_COMMAND_OK) { found = true; + + /* exit and report missing support library with special message */ + if (strcmp(lib, PG_UPGRADE_SUPPORT) == 0) + pg_log(PG_FATAL, + "The pg_upgrade_support module must be created and installed in the new cluster.\n"); + if (script == NULL && (script = fopen(output_path, "w")) == NULL) pg_log(PG_FATAL, "Could not create necessary file: %s\n", output_path); |