151
152
FirstNormalObjectId);
152
153
totaltups += PQntuples(ress[dbnum]);
156
* Systems that install plpython before 8.1 have
157
* plpython_call_handler() defined in the "public" schema, causing
158
* pg_dumpall to dump it. However that function still references
159
* "plpython" (no "2"), so it throws an error on restore. This code
160
* checks for the problem function, reports affected databases to the
161
* user and explains how to remove them.
162
* 8.1 git commit: e0dedd0559f005d60c69c9772163e69c204bac69
163
* http://archives.postgresql.org/pgsql-hackers/2012-03/msg01101.php
164
* http://archives.postgresql.org/pgsql-bugs/2012-05/msg00206.php
166
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901)
170
res = executeQueryOrDie(conn,
172
"FROM pg_catalog.pg_proc JOIN pg_namespace "
173
" ON pronamespace = pg_namespace.oid "
174
"WHERE proname = 'plpython_call_handler' AND "
175
"nspname = 'public' AND "
176
"prolang = 13 /* C */ AND "
177
"probin = '$libdir/plpython' AND "
178
"pg_proc.oid >= %u;",
179
FirstNormalObjectId);
180
if (PQntuples(res) > 0)
182
if (!found_public_plpython_handler)
185
"\nThe old cluster has a \"plpython_call_handler\" function defined\n"
186
"in the \"public\" schema which is a duplicate of the one defined\n"
187
"in the \"pg_catalog\" schema. You can confirm this by executing\n"
190
" \\df *.plpython_call_handler\n"
192
"The \"public\" schema version of this function was created by a\n"
193
"pre-8.1 install of plpython, and must be removed for pg_upgrade\n"
194
"to complete because it references a now-obsolete \"plpython\"\n"
195
"shared object file. You can remove the \"public\" schema version\n"
196
"of this function by running the following command:\n"
198
" DROP FUNCTION public.plpython_call_handler()\n"
200
"in each affected database:\n"
203
pg_log(PG_WARNING, " %s\n", active_db->db_name);
204
found_public_plpython_handler = true;
212
if (found_public_plpython_handler)
214
"Remove the problem functions from the old cluster to continue.\n");
157
216
totaltups++; /* reserve for pg_upgrade_support */
159
218
/* Allocate what's certainly enough space */