I upgraded my postgres from 13.5 to 16.2 version (and the RHEL from 7.5 to 8.9). The problem is, python was not upgraded.
I created procedure pyver():
CREATE OR REPLACE FUNCTION pyver ()
RETURNS TEXT
AS $$
import sys
pyversion = sys.version
return pyversion
$$ LANGUAGE 'plpython3u';
For show of python version used by Postgres.
When I run it on Python 13.5, I get this result:
psql (13.5)
Type "help" for help.
postgres@database # select pyver();
pyver
-----------------------------------------
3.6.8 (default, Aug 13 2020, 07:36:02) +
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
(1 řádka)
postgres@database #
And when I run it on upgraded DB, I get this result:
psql (16.2)
Type "help" for help.
database=# select pyver();
pyver
-----------------------------------------
3.6.8 (default, Jan 5 2024, 09:14:44) +
[GCC 8.5.0 20210514 (Red Hat 8.5.0-20)]
(1 row)
database=#
On the new RedHat is Python 3.9.18 installed.
How do I get postgres to use a newer version of python?
Upgrade was made by this way:
- was installed new server with RedHat 8.9 (Python 3.9)
- was installed Postgres binaries (version 13.5) and created user postgres
- then was connected disk with Postgres databases (version 13.5) from old server
- the DB's was started on new server
- next step was installation of Postgres 16.2
- then was start with upgrade of DB's to new Postgres version via this command:
time /usr/pgsql-16/bin/pg_upgrade --jobs=16 -d /postgres/pgsql/database/data13 -D /postgres/pgsql/database/data16 -b /usr/pgsql-13/bin/ -B /usr/pgsql-16/bin/ --link
- after upgrade runs DB's on new version
And now we find the proglem with Python.
The main DB has 70TB size.
Thanks Michal