Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fa4dad6

Browse files
committed
In pg_upgrade, when checking for the plpython library, we must check for
"plpython2" when upgrading from pre-PG 9.1. Patch to head and 9.1. Per report from Peter.
1 parent e9cdb00 commit fa4dad6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

contrib/pg_upgrade/function.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,24 @@ check_loadable_libraries(void)
227227
char *cmd = (char *) pg_malloc(8 + 2 * llen + 1);
228228
PGresult *res;
229229

230+
/*
231+
* In Postgres 9.0, Python 3 support was added, and to do that, a
232+
* plpython2u language was created with library name plpython2.so
233+
* as a symbolic link to plpython.so. In Postgres 9.1, only the
234+
* plpython2.so library was created, and both plpythonu and
235+
* plpython2u pointing to it. For this reason, any reference to
236+
* library name "plpython" in an old PG <= 9.1 cluster must look
237+
* for "plpython2" in the new cluster.
238+
*/
239+
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
240+
strcmp(lib, "$libdir/plpython") == 0)
241+
{
242+
lib = "$libdir/plpython2";
243+
llen = strlen(lib);
244+
}
245+
230246
strcpy(cmd, "LOAD '");
231-
PQescapeStringConn(conn, cmd + 6, lib, llen, NULL);
247+
PQescapeStringConn(conn, cmd + strlen(cmd), lib, llen, NULL);
232248
strcat(cmd, "'");
233249

234250
res = PQexec(conn, cmd);

0 commit comments

Comments
 (0)