Re: pg_upgrade from 12 to 13 failes with plpython2 - Mailing list pgsql-general

From Marcin Giedz
Subject Re: pg_upgrade from 12 to 13 failes with plpython2
Date
Msg-id 241497908.1487873.1605693947374.JavaMail.zimbra@arise.pl
Whole thread Raw
In response to Re: pg_upgrade from 12 to 13 failes with plpython2  (Magnus Hagander <magnus@hagander.net>)
Responses Re: pg_upgrade from 12 to 13 failes with plpython2  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general
right, I had one function relaying on plpython2u so I changed it... but the again pg_upgrade claims error with python:

cat loadable_libraries.txt
could not load library "$libdir/plpython2": ERROR:  could not access file "$libdir/plpython2": No such file or directory
In database: argosrm
In database: template1




marcin@carbon2:~$ psql -U pgsql -h 192.168.89.64 postgres
psql (12.4 (Ubuntu 12.4-1), server 12.5)
Type "help" for help.

postgres=# select * from pg_language ;
  oid  | lanname  | lanowner | lanispl | lanpltrusted | lanplcallfoid | laninline | lanvalidator | lanacl
-------+----------+----------+---------+--------------+---------------+-----------+--------------+--------
    12 | internal |       10 | f       | f            |             0 |         0 |         2246 |
    13 | c        |       10 | f       | f            |             0 |         0 |         2247 |
    14 | sql      |       10 | f       | t            |             0 |         0 |         2248 |
 14177 | plpgsql  |       10 | t       | t            |         14174 |     14175 |        14176 |
(4 rows)

postgres=# \c argosrm
psql (12.4 (Ubuntu 12.4-1), server 12.5)
You are now connected to database "argosrm" as user "pgsql".
argosrm=# select * from pg_language ;
   oid   |  lanname   | lanowner | lanispl | lanpltrusted | lanplcallfoid | laninline | lanvalidator | lanacl
---------+------------+----------+---------+--------------+---------------+-----------+--------------+--------
      12 | internal   |       10 | f       | f            |             0 |         0 |         2246 |
      13 | c          |       10 | f       | f            |             0 |         0 |         2247 |
      14 | sql        |       10 | f       | t            |             0 |         0 |         2248 |
   14177 | plpgsql    |       10 | t       | t            |         14174 |     14175 |        14176 |
 1824389 | plpython3u |       10 | t       | f            |       1824386 |   1824387 |      1824388 |
(5 rows)

argosrm=# \c template1
psql (12.4 (Ubuntu 12.4-1), server 12.5)
You are now connected to database "template1" as user "pgsql".
template1=# select * from pg_language ;
  oid  | lanname  | lanowner | lanispl | lanpltrusted | lanplcallfoid | laninline | lanvalidator | lanacl
-------+----------+----------+---------+--------------+---------------+-----------+--------------+--------
    12 | internal |       10 | f       | f            |             0 |         0 |         2246 |
    13 | c        |       10 | f       | f            |             0 |         0 |         2247 |
    14 | sql      |       10 | f       | t            |             0 |         0 |         2248 |
 14177 | plpgsql  |       10 | t       | t            |         14174 |     14175 |        14176 |
(4 rows)

template1=# drop language plpython2u;
ERROR:  language "plpython2u" does not exist
template1=# drop language plpython;
ERROR:  language "plpython" does not exist
template1=# drop language plpythonu;
ERROR:  language "plpythonu" does not exist

template1=# \c postgres
psql (12.4 (Ubuntu 12.4-1), server 12.5)
You are now connected to database "postgres" as user "pgsql".
postgres=# drop language plpythonu;
ERROR:  language "plpythonu" does not exist
postgres=# drop language plpython;
ERROR:  language "plpython" does not exist
postgres=# drop language plpython2u;
ERROR:  language "plpython2u" does not exist


postgres=# \c argosrm
psql (12.4 (Ubuntu 12.4-1), server 12.5)
You are now connected to database "argosrm" as user "pgsql".
argosrm=# drop language plpython2u;
ERROR:  language "plpython2u" does not exist
argosrm=# drop language plpython;
ERROR:  language "plpython" does not exist
argosrm=# drop language plpythonu;
ERROR:  language "plpythonu" does not exist
argosrm=#


argosrm=# select * from pg_pltemplate    ;
  tmplname  | tmpltrusted | tmpldbacreate |      tmplhandler       |        tmplinline        |    tmplvalidator    |    tmpllibrary    | tmplacl
------------+-------------+---------------+------------------------+--------------------------+---------------------+-------------------+---------
 plpgsql    | t           | t             | plpgsql_call_handler   | plpgsql_inline_handler   | plpgsql_validator   | $libdir/plpgsql   |
 pltcl      | t           | t             | pltcl_call_handler     |                          |                     | $libdir/pltcl     |
 pltclu     | f           | f             | pltclu_call_handler    |                          |                     | $libdir/pltcl     |
 plperl     | t           | t             | plperl_call_handler    | plperl_inline_handler    | plperl_validator    | $libdir/plperl    |
 plperlu    | f           | f             | plperlu_call_handler   | plperlu_inline_handler   | plperlu_validator   | $libdir/plperl    |
 plpython3u | f           | f             | plpython3_call_handler | plpython3_inline_handler | plpython3_validator | $libdir/plpython3 |
(6 rows)

argosrm=# \c postgres
psql (12.4 (Ubuntu 12.4-1), server 12.5)
You are now connected to database "postgres" as user "pgsql".
postgres=# select * from pg_pltemplate    ;
  tmplname  | tmpltrusted | tmpldbacreate |      tmplhandler       |        tmplinline        |    tmplvalidator    |    tmpllibrary    | tmplacl
------------+-------------+---------------+------------------------+--------------------------+---------------------+-------------------+---------
 plpgsql    | t           | t             | plpgsql_call_handler   | plpgsql_inline_handler   | plpgsql_validator   | $libdir/plpgsql   |
 pltcl      | t           | t             | pltcl_call_handler     |                          |                     | $libdir/pltcl     |
 pltclu     | f           | f             | pltclu_call_handler    |                          |                     | $libdir/pltcl     |
 plperl     | t           | t             | plperl_call_handler    | plperl_inline_handler    | plperl_validator    | $libdir/plperl    |
 plperlu    | f           | f             | plperlu_call_handler   | plperlu_inline_handler   | plperlu_validator   | $libdir/plperl    |
 plpython3u | f           | f             | plpython3_call_handler | plpython3_inline_handler | plpython3_validator | $libdir/plpython3 |
(6 rows)

postgres=# \c template1
psql (12.4 (Ubuntu 12.4-1), server 12.5)
You are now connected to database "template1" as user "pgsql".
template1=# select * from pg_pltemplate    ;
  tmplname  | tmpltrusted | tmpldbacreate |      tmplhandler       |        tmplinline        |    tmplvalidator    |    tmpllibrary    | tmplacl
------------+-------------+---------------+------------------------+--------------------------+---------------------+-------------------+---------
 plpgsql    | t           | t             | plpgsql_call_handler   | plpgsql_inline_handler   | plpgsql_validator   | $libdir/plpgsql   |
 pltcl      | t           | t             | pltcl_call_handler     |                          |                     | $libdir/pltcl     |
 pltclu     | f           | f             | pltclu_call_handler    |                          |                     | $libdir/pltcl     |
 plperl     | t           | t             | plperl_call_handler    | plperl_inline_handler    | plperl_validator    | $libdir/plperl    |
 plperlu    | f           | f             | plperlu_call_handler   | plperlu_inline_handler   | plperlu_validator   | $libdir/plperl    |
 plpython3u | f           | f             | plpython3_call_handler | plpython3_inline_handler | plpython3_validator | $libdir/plpython3 |
(6 rows)

template1=#






Od: "Magnus Hagander" <magnus@hagander.net>
Do: "Marcin Giedz" <marcin.giedz@arise.pl>
DW: "Adrian Klaver" <adrian.klaver@aklaver.com>, "Tom Lane" <tgl@sss.pgh.pa.us>, "Devrim Gündüz" <devrim@gunduz.org>, "pgsql-general" <pgsql-general@lists.postgresql.org>
Wysłane: środa, 18 listopad 2020 10:36:10
Temat: Re: pg_upgrade from 12 to 13 failes with plpython2

On Wed, Nov 18, 2020 at 8:11 AM Marcin Giedz <marcin.giedz@arise.pl> wrote:
>
> but my question still remains the same - what causes pg_upgrade failure - are functions the reason? what I did was to delete these 2 rows from pg_pltemplate as I thought this may help:
>
> postgres=# delete from pg_pltemplate where tmplname = 'plpython2u';
> DELETE 1
> postgres=# delete from pg_pltemplate where tmplname = 'plpythonu';
> DELETE 1
>
>
> but pg_upgrade still complains about plpython2:
>
> cat loadable_libraries.txt
> could not load library "$libdir/plpython2": ERROR:  could not access file "$libdir/plpython2": No such file or directory
> In database: alaxx
> In database: template1


It's not the template that's interesting, it's the language itself you
need to drop. Log into each database and try to do that, and you will
get something like this if you still have functions using it:
postgres=# DROP LANGUAGE plpython2u;
ERROR:  cannot drop language plpython2u because other objects depend on it
DETAIL:  function testfunc() depends on language plpython2u
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

If you have no functions using it, it will just go away, and once you
have dropped it in both databases you should be good to go.

And of course, if there are functions depending on it, you should
rebuild those on plpython3u before you drop plpython2u (or drop the
functions if they're not in use).

--
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/

--
Pozdrawiam
Marcin Giedz
Wiceprezes Zarządu

ARISE Sp. z o.o.
mob. +48 606 673 977
mail: marcin.giedz@arise.pl

Al. Solidarności 117
00-140 Warszawa
tel. +48 (22) 440 56 20
fax  +48 (22) 440 56 22
http://www.arise.pl

Grupa ARISE: ARISE Sp. z o.o. (podmiot dominujący), ARISE Services S.A., Al. Solidarności 117, 00-140 Warszawa, Sąd Rejonowy dla m. st. Warszawy w Warszawie XII Wydział Gospodarczy Krajowego Rejestru Sądowego, KRS 0000316860, REGON 141595449, NIP 5272590610, kapitał zakładowy wpłacony 250,000.00 zł.

pgsql-general by date:

Previous
From: Olivier Gautherot
Date:
Subject: Re: vacuum vs vacuum full
Next
From: Snjezana Frketic
Date:
Subject: How to select values in a JSON type of column?