| PostgreSQL 9.1.12 Documentation | ||||
|---|---|---|---|---|
| Prev | Up | Chapter 42. PL/Python - Python Procedural Language | Next | |
PL/Python supports both the Python 2 and Python 3 language variants. (The PostgreSQL installation instructions might contain more precise information about the exact supported minor versions of Python.) Because the Python 2 and Python 3 language variants are incompatible in some important aspects, the following naming and transitioning scheme is used by PL/Python to avoid mixing them:
The PostgreSQL language named plpython2u implements PL/Python based on the Python 2 language variant.
The PostgreSQL language named plpython3u implements PL/Python based on the Python 3 language variant.
The language named plpythonu implements PL/Python based on the default Python language variant, which is currently Python 2. (This default is independent of what any local Python installations might consider to be their "default", for example, what /usr/bin/python might be.) The default will probably be changed to Python 3 in a distant future release of PostgreSQL, depending on the progress of the migration to Python 3 in the Python community.
It depends on the build configuration or the installed packages whether PL/Python for Python 2 or Python 3 or both are available.
Tip: The built variant depends on which Python version was found during the installation or which version was explicitly set using the PYTHON environment variable; see Section 15.4. To make both variants of PL/Python available in one installation, the source tree has to be configured and built twice.
This results in the following usage and migration strategy:
Existing users and users who are currently not interested in Python 3 use the language name plpythonu and don't have to change anything for the foreseeable future. It is recommended to gradually "future-proof"