13 #include "catalog/pg_language_d.h" 30 const char *str1 = ((
const LibraryInfo *) p1)->name;
31 const char *str2 = ((
const LibraryInfo *) p2)->name;
32 int slen1 = strlen(str1);
33 int slen2 = strlen(str2);
34 int cmp = strcmp(str1, str2);
58 bool found_public_plpython_handler =
false;
73 "SELECT DISTINCT probin " 74 "FROM pg_catalog.pg_proc " 75 "WHERE prolang = %u AND " 76 "probin IS NOT NULL AND " 99 "FROM pg_catalog.pg_proc p " 100 " JOIN pg_catalog.pg_namespace n " 101 " ON pronamespace = n.oid " 102 "WHERE proname = 'plpython_call_handler' AND " 103 "nspname = 'public' AND " 105 "probin = '$libdir/plpython' AND " 111 if (!found_public_plpython_handler)
114 "\nThe old cluster has a \"plpython_call_handler\" function defined\n" 115 "in the \"public\" schema which is a duplicate of the one defined\n" 116 "in the \"pg_catalog\" schema. You can confirm this by executing\n" 119 " \\df *.plpython_call_handler\n" 121 "The \"public\" schema version of this function was created by a\n" 122 "pre-8.1 install of plpython, and must be removed for pg_upgrade\n" 123 "to complete because it references a now-obsolete \"plpython\"\n" 124 "shared object file. You can remove the \"public\" schema version\n" 125 "of this function by running the following command:\n" 127 " DROP FUNCTION public.plpython_call_handler()\n" 129 "in each affected database:\n" 133 found_public_plpython_handler =
true;
141 if (found_public_plpython_handler)
142 pg_fatal(
"Remove the problem functions from the old cluster to continue.\n");
154 for (rowno = 0; rowno < ntups; rowno++)
184 int was_load_failure =
false;
189 prep_status(
"Checking for presence of required libraries");
191 snprintf(output_path,
sizeof(output_path),
"loadable_libraries.txt");
205 int llen = strlen(lib);
226 strcmp(lib,
"$libdir/plpython") == 0)
228 lib =
"$libdir/plpython2";
232 strcpy(cmd,
"LOAD '");
241 was_load_failure =
true;
243 if (script == NULL && (script =
fopen_priv(output_path,
"w")) == NULL)
244 pg_fatal(
"could not open file \"%s\": %s\n",
246 fprintf(script,
_(
"could not load library \"%s\": %s"),
251 was_load_failure =
false;
256 if (was_load_failure)
257 fprintf(script,
_(
"In database: %s\n"),
267 pg_fatal(
"Your installation references loadable libraries that are missing from the\n" 268 "new installation. You can add these libraries to the new installation,\n" 269 "or remove the functions using them from the old installation. A list of\n" 270 "problem libraries is in the file:\n" 271 " %s\n\n", output_path);
char * PQerrorMessage(const PGconn *conn)
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
void * pg_malloc(size_t size)
void check_loadable_libraries(void)
PGresult * executeQueryOrDie(PGconn *conn, const char *fmt,...) pg_attribute_printf(2
#define GET_MAJOR_VERSION(v)
void PQfinish(PGconn *conn)
int PQntuples(const PGresult *res)
ExecStatusType PQresultStatus(const PGresult *res)
#define FirstNormalObjectId
void prep_status(const char *fmt,...) pg_attribute_printf(1
char * pg_strdup(const char *in)
size_t PQescapeStringConn(PGconn *conn, char *to, const char *from, size_t length, int *error)
static int library_name_compare(const void *p1, const void *p2)
static void check_ok(void)
PGconn * connectToServer(ClusterInfo *cluster, const char *db_name)
void PQclear(PGresult *res)
void get_loadable_libraries(void)
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
#define fopen_priv(path, mode)
PGresult * PQexec(PGconn *conn, const char *query)
#define qsort(a, b, c, d)
static int cmp(const chr *x, const chr *y, size_t len)