I'm trying to perform PostgreSQL 9.6 -> 10 upgrade with link method:

/usr/lib/postgresql/10/bin/pg_upgrade --link \
 --old-datadir=/var/lib/postgresql/9.6/main \
 --new-datadir=/var/lib/postgresql/10/main \
 --old-bindir=/usr/lib/postgresql/9.6/bin \
 --new-bindir=/usr/lib/postgresql/10/bin \
 --old-options=' -c config_file=/etc/postgresql/9.6/main/postgresql.conf' \
 --new-options=' -c config_file=/etc/postgresql/10/main/postgresql.conf' \
 --old-port=5432 \

however the upgrade process always fails on "untrusted languages":

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 535968; 0 0 ACL LANGUAGE "plpythonu" postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  language "plpythonu" is not trusted
DETAIL:  GRANT and REVOKE are not allowed on untrusted languages, because only superusers can use untrusted languages.
    Command was: GRANT ALL ON LANGUAGE "plpythonu" TO "mydb";

Any idea how to fix this? I've already tried dropping plpythonu extension before upgrade.

  • I not sure but this could be a reason, While installing this language it might make an entry on pg_language. But the newer version sys tables might not have this. – Bhuvanesh Jun 11 '18 at 9:04
  • @SQLadmin I had to plpythonu functions in all namespaces. – Tombart Jun 16 '18 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.