FS#36875 - [postgresql] Python 3 (plpython3u) support

Attached to Project: Arch Linux
Opened by paradoxxx (zero) - Wednesday, 11 September 2013, 12:30 GMT
Last edited by Levente Polyak (anthraxx) - Friday, 11 May 2018, 01:22 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Dan McGee (toofishes)
Levente Polyak (anthraxx)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No

Details

Description:
Python 3 is now by default in arch since a long time, maybe it's time to support it in the postgres build.

A better option might be a generating 2 different optional packages (postgres-lib-python2, postgres-lib-python for instance). Debian already ships the plpython libs like this (http://packages.debian.org/stable/database/postgresql-plpython-9.1, http://packages.debian.org/stable/database/postgresql-plpython3-9.1)

I managed to alter the postgres PKGBUILD in order to have two different build dirs (as it is required to run twice the configure with the different python versions) to generate both packages, see attached PKGBUILD.

Warning: The attached PKGBUILD is just an example of how I managed to generate both plpython libs.

Thanks

Additional info:
* Concerns postgresql-9.3.0, postgresql-libs-9.3.0
   PKGBUILD (6.6 KiB)
This task depends upon

Closed by  Levente Polyak (anthraxx)
Friday, 11 May 2018, 01:22 GMT
Reason for closing:  Implemented
Additional comments about closing:  10.4-1
Comment by Dan McGee (toofishes) - Friday, 06 December 2013, 15:48 GMT
Is there no way we can get a side-by-side install of something like plpython2.so and plpython3.so?
Comment by paradoxxx (zero) - Friday, 06 December 2013, 16:34 GMT
Totally, I managed to make a package that only install plpython3 libs: https://aur.archlinux.org/packages/postgresql-python/
Comment by David Ford (FirefighterBlu3) - Tuesday, 08 September 2015, 01:12 GMT
Please change the default of python2 to python3 which is the de facto installation of python on ArchLinux
Comment by Dario Ostuni (dariost) - Wednesday, 11 January 2017, 15:54 GMT
This problem is still present in postgresql 9.6.1-3
Comment by Andrei Antonov (pl_m) - Tuesday, 24 January 2017, 19:46 GMT
> Is there no way we can get a side-by-side install of something like plpython2.so and plpython3.so?

I think in modern version of Postgres -- will NOT problem with install both version of plpython<?>u (at same time. but in not use both it in one PG-session),

from Postgres documentation:

> It is not allowed to use PL/Python based on Python 2 and PL/Python based on Python 3 in the same session, because the symbols in the dynamic modules would clash, which could result in crashes of the PostgreSQL server process. There is a check that prevents mixing Python major versions in a session, which will abort the session if a mismatch is detected. It is possible, however, to use both PL/Python variants in the same database, from separate sessions.

thanks in advance! :-)
Comment by Dario Ostuni (dariost) - Monday, 10 July 2017, 16:25 GMT
Any updates on this?
Comment by Jiří Pinkava (pinky) - Tuesday, 13 March 2018, 01:29 GMT
This patch modifyes PKGBUILD in way plpython3u support is builtin, it does:

* make separate copy of source tree
* configure and build one tree with python2 and another with python3
* run installation from tree build with python3 and then the other build with python2

In final package files from python2 build overwrite identical files from python3 build. Extra files specific to python3 support are added. This should work fine because this is extension and there shoudl not be common file with different content.

I have tested it so far it runs trivial python code.
Comment by Levente Polyak (anthraxx) - Friday, 11 May 2018, 01:21 GMT
shipping python3 variant in 10.4-1.
However, default python in postgres is 2 per definition of postgres, this will only change when postgres changes it. Very explicitly defined here: https://www.postgresql.org/docs/9.6/static/plpython-python23.html

Loading...