1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

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
This commit is contained in:
Bruce Momjian
2012-03-19 09:31:50 -04:00
parent e3fc4a97bc
commit 02b183acb4
2 changed files with 11 additions and 46 deletions

View File

@ -13,6 +13,7 @@
#include "access/transam.h"
#define PG_UPGRADE_SUPPORT "$libdir/pg_upgrade_support"
/*
* install_support_functions_in_new_db()
@ -154,17 +155,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++)
{
@ -256,6 +257,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_priv(output_path, "w")) == NULL)
pg_log(PG_FATAL, "Could not open file \"%s\": %s\n",
output_path, getErrorText(errno));