diff options
author | Bruce Momjian <bruce@momjian.us> | 2012-01-24 22:42:37 -0500 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2012-01-24 22:42:37 -0500 |
commit | cfe443ab9d42b4ffe950608f01c3a4bdc2895c7b (patch) | |
tree | a99f2d0611f4af65b81d9b13b2a1ab8d78920b4c | |
parent | b95aec529014355f4f90c5095993404ff0291b02 (diff) | |
download | postgresql-cfe443ab9d42b4ffe950608f01c3a4bdc2895c7b.tar.gz postgresql-cfe443ab9d42b4ffe950608f01c3a4bdc2895c7b.zip |
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.
-rw-r--r-- | contrib/pg_upgrade/function.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/contrib/pg_upgrade/function.c b/contrib/pg_upgrade/function.c index 54f139a7988..4505e51a932 100644 --- a/contrib/pg_upgrade/function.c +++ b/contrib/pg_upgrade/function.c @@ -228,8 +228,24 @@ check_loadable_libraries(void) char *cmd = (char *) pg_malloc(8 + 2 * llen + 1); PGresult *res; + /* + * In Postgres 9.0, Python 3 support was added, and to do that, a + * plpython2u language was created with library name plpython2.so + * as a symbolic link to plpython.so. In Postgres 9.1, only the + * plpython2.so library was created, and both plpythonu and + * plpython2u pointing to it. For this reason, any reference to + * library name "plpython" in an old PG <= 9.1 cluster must look + * for "plpython2" in the new cluster. + */ + if (GET_MAJOR_VERSION(old_cluster.major_version) < 901 && + strcmp(lib, "$libdir/plpython") == 0) + { + lib = "$libdir/plpython2"; + llen = strlen(lib); + } + strcpy(cmd, "LOAD '"); - PQescapeStringConn(conn, cmd + 6, lib, llen, NULL); + PQescapeStringConn(conn, cmd + strlen(cmd), lib, llen, NULL); strcat(cmd, "'"); res = PQexec(conn, cmd); |