13 #include "catalog/pg_language_d.h"
30 const char *str1 = ((
const LibraryInfo *) p1)->name;
32 int slen1 = strlen(str1);
33 int slen2 = strlen(str2);
34 int cmp = strcmp(str1, str2);
72 "SELECT DISTINCT probin "
73 "FROM pg_catalog.pg_proc "
74 "WHERE prolang = %u AND "
75 "probin IS NOT NULL AND "
94 for (rowno = 0; rowno < ntups; rowno++)
124 int was_load_failure =
false;
129 prep_status(
"Checking for presence of required libraries");
131 snprintf(output_path,
sizeof(output_path),
"%s/%s",
146 int llen = strlen(lib);
153 strcpy(cmd,
"LOAD '");
162 was_load_failure =
true;
164 if (script == NULL && (script =
fopen_priv(output_path,
"w")) == NULL)
165 pg_fatal(
"could not open file \"%s\": %s\n",
167 fprintf(script,
_(
"could not load library \"%s\": %s"),
172 was_load_failure =
false;
177 if (was_load_failure)
178 fprintf(script,
_(
"In database: %s\n"),
188 pg_fatal(
"Your installation references loadable libraries that are missing from the\n"
189 "new installation. You can add these libraries to the new installation,\n"
190 "or remove the functions using them from the old installation. A list of\n"
191 "problem libraries is in the file:\n"
192 " %s\n\n", output_path);
static void PGresult const char * p2
static void PGresult * res
char * PQerrorMessage(const PGconn *conn)
void PQfinish(PGconn *conn)
size_t PQescapeStringConn(PGconn *conn, char *to, const char *from, size_t length, int *error)
ExecStatusType PQresultStatus(const PGresult *res)
void PQclear(PGresult *res)
int PQntuples(const PGresult *res)
PGresult * PQexec(PGconn *conn, const char *query)
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
char * pg_strdup(const char *in)
void * pg_malloc(size_t size)
void check_loadable_libraries(void)
static int library_name_compare(const void *p1, const void *p2)
void get_loadable_libraries(void)
static void check_ok(void)
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
#define fopen_priv(path, mode)
PGconn * connectToServer(ClusterInfo *cluster, const char *db_name)
void prep_status(const char *fmt,...) pg_attribute_printf(1
PGresult * executeQueryOrDie(PGconn *conn, const char *fmt,...) pg_attribute_printf(2
#define qsort(a, b, c, d)
static int cmp(const chr *x, const chr *y, size_t len)
#define FirstNormalObjectId