Reputation: 3
I have a Ubuntu 18.04 with Postgres 10 server running Python 3.5.2, PL/Python function works very well.
How can I upgrade PL/Python to 3.8.0
I used pyenv to install 3.8.0 under user 'postgres', I checked python version already 3.8.0, I even updated /etc/postgresql/10/main/environment to
PYTHONPATH= '/var/lib/postgresql/.pyenv/shims/python3'
But when I run PL/Python function
CREATE FUNCTION ptest ()
RETURNS text
AS $$
import sys
return sys.version
$$ LANGUAGE plpython3u;
The result still 3.5.2
Upvotes: 0
Views: 1015
Reputation: 1
To answer the question why.... Two Reasons:
I agree that you shouldn't "force" an upgrade if it's not supported by the Postgresql - PL/Python team yet.
To work around this... I've seen some folks use virtual environments inside of PL/Python. Trying to avoid going that route if I can, rather way for direct support from the Postgresql PL/Python team.
Upvotes: 0
Reputation: 44137
PostgreSQL's plpython extension needs to be compiled against the correct python header files. I doubt the header files are binary compatible between python 3.5 and 3.8. You will either need to recompile the PostgreSQL extension (or all of PostgreSQL) yourself, or find a package which ships the correctly compiled packages (which I doubt you will find).
The simple answer is, "don't do this". Why do you want to do this? If I were willing to build my own against a bleeding edge python, I would probably be doing it with a bleeding edge PostgreSQL, not the two year old version.
Upvotes: 1