Skip to content

Commit cfe443a

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 b95aec5 commit cfe443a

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
@@ -228,8 +228,24 @@ check_loadable_libraries(void)
228228
char *cmd = (char *) pg_malloc(8 + 2 * llen + 1);
229229
PGresult *res;
230230

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

235251
res = PQexec(conn, cmd);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy