2 Chapter 44. PL/Python — Python Procedural Language
6 44.1. PL/Python Functions
9 44.2.1. Data Type Mapping
12 44.2.4. Composite Types
13 44.2.5. Set-Returning Functions
16 44.4. Anonymous Code Blocks
17 44.5. Trigger Functions
20 44.6.1. Database Access Functions
21 44.6.2. Trapping Errors
23 44.7. Explicit Subtransactions
25 44.7.1. Subtransaction Context Managers
27 44.8. Transaction Management
28 44.9. Utility Functions
29 44.10. Python 2 vs. Python 3
30 44.11. Environment Variables
32 The PL/Python procedural language allows PostgreSQL functions and
33 procedures to be written in the Python language.
35 To install PL/Python in a particular database, use CREATE EXTENSION
40 If a language is installed into template1, all subsequently created
41 databases will have the language installed automatically.
43 PL/Python is only available as an “untrusted” language, meaning it does
44 not offer any way of restricting what users can do in it and is
45 therefore named plpython3u. A trusted variant plpython might become
46 available in the future if a secure execution mechanism is developed in
47 Python. The writer of a function in untrusted PL/Python must take care
48 that the function cannot be used to do anything unwanted, since it will
49 be able to do anything that could be done by a user logged in as the
50 database administrator. Only superusers can create functions in
51 untrusted languages such as plpython3u.
55 Users of source packages must specially enable the build of PL/Python
56 during the installation process. (Refer to the installation
57 instructions for more information.) Users of binary packages might find
58 PL/Python in a separate subpackage.