summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/plpython.html
blob: 9f7bda0ca7b9ebff1545718d468c5e58de931948 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 46. PL/Python — Python Procedural Language</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="plperl-under-the-hood.html" title="45.8. PL/Perl Under the Hood" /><link rel="next" href="plpython-python23.html" title="46.1. Python 2 vs. Python 3" /></head><body id="docContent" class="container-fluid col-10"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">Chapter 46. PL/Python — Python Procedural Language</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="plperl-under-the-hood.html" title="45.8. PL/Perl Under the Hood">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="server-programming.html" title="Part V. Server Programming">Up</a></td><th width="60%" align="center">Part V. Server Programming</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 14.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="plpython-python23.html" title="46.1. Python 2 vs. Python 3">Next</a></td></tr></table><hr></hr></div><div class="chapter" id="PLPYTHON"><div class="titlepage"><div><div><h2 class="title">Chapter 46. PL/Python — Python Procedural Language</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="plpython-python23.html">46.1. Python 2 vs. Python 3</a></span></dt><dt><span class="sect1"><a href="plpython-funcs.html">46.2. PL/Python Functions</a></span></dt><dt><span class="sect1"><a href="plpython-data.html">46.3. Data Values</a></span></dt><dd><dl><dt><span class="sect2"><a href="plpython-data.html#id-1.8.11.11.3">46.3.1. Data Type Mapping</a></span></dt><dt><span class="sect2"><a href="plpython-data.html#id-1.8.11.11.4">46.3.2. Null, None</a></span></dt><dt><span class="sect2"><a href="plpython-data.html#PLPYTHON-ARRAYS">46.3.3. Arrays, Lists</a></span></dt><dt><span class="sect2"><a href="plpython-data.html#id-1.8.11.11.6">46.3.4. Composite Types</a></span></dt><dt><span class="sect2"><a href="plpython-data.html#id-1.8.11.11.7">46.3.5. Set-Returning Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="plpython-sharing.html">46.4. Sharing Data</a></span></dt><dt><span class="sect1"><a href="plpython-do.html">46.5. Anonymous Code Blocks</a></span></dt><dt><span class="sect1"><a href="plpython-trigger.html">46.6. Trigger Functions</a></span></dt><dt><span class="sect1"><a href="plpython-database.html">46.7. Database Access</a></span></dt><dd><dl><dt><span class="sect2"><a href="plpython-database.html#id-1.8.11.15.3">46.7.1. Database Access Functions</a></span></dt><dt><span class="sect2"><a href="plpython-database.html#PLPYTHON-TRAPPING">46.7.2. Trapping Errors</a></span></dt></dl></dd><dt><span class="sect1"><a href="plpython-subtransaction.html">46.8. Explicit Subtransactions</a></span></dt><dd><dl><dt><span class="sect2"><a href="plpython-subtransaction.html#id-1.8.11.16.3">46.8.1. Subtransaction Context Managers</a></span></dt><dt><span class="sect2"><a href="plpython-subtransaction.html#id-1.8.11.16.4">46.8.2. Older Python Versions</a></span></dt></dl></dd><dt><span class="sect1"><a href="plpython-transactions.html">46.9. Transaction Management</a></span></dt><dt><span class="sect1"><a href="plpython-util.html">46.10. Utility Functions</a></span></dt><dt><span class="sect1"><a href="plpython-envar.html">46.11. Environment Variables</a></span></dt></dl></div><a id="id-1.8.11.2" class="indexterm"></a><a id="id-1.8.11.3" class="indexterm"></a><p>
  The <span class="application">PL/Python</span> procedural language allows
  <span class="productname">PostgreSQL</span> functions and procedures to be written in the
  <a class="ulink" href="https://www.python.org" target="_top">Python language</a>.
 </p><p>
  To install PL/Python in a particular database, use
  <code class="literal">CREATE EXTENSION plpythonu</code> (but
  see also <a class="xref" href="plpython-python23.html" title="46.1. Python 2 vs. Python 3">Section 46.1</a>).
 </p><div class="tip"><h3 class="title">Tip</h3><p>
    If a language is installed into <code class="literal">template1</code>, all subsequently
    created databases will have the language installed automatically.
   </p></div><p>
  PL/Python is only available as an <span class="quote"><span class="quote">untrusted</span></span> language, meaning
  it does not offer any way of restricting what users can do in it and
  is therefore named <code class="literal">plpythonu</code>.  A trusted
  variant <code class="literal">plpython</code> might become available in the future
  if a secure execution mechanism is developed in Python.  The
  writer of a function in untrusted PL/Python must take care that the
  function cannot be used to do anything unwanted, since it will be
  able to do anything that could be done by a user logged in as the
  database administrator.  Only superusers can create functions in
  untrusted languages such as <code class="literal">plpythonu</code>.
 </p><div class="note"><h3 class="title">Note</h3><p>
   Users of source packages must specially enable the build of
   PL/Python during the installation process.  (Refer to the
   installation instructions for more information.)  Users of binary
   packages might find PL/Python in a separate subpackage.
  </p></div></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="plperl-under-the-hood.html" title="45.8. PL/Perl Under the Hood">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="server-programming.html" title="Part V. Server Programming">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="plpython-python23.html" title="46.1. Python 2 vs. Python 3">Next</a></td></tr><tr><td width="40%" align="left" valign="top">45.8. PL/Perl Under the Hood </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 14.5 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 46.1. Python 2 vs. Python 3</td></tr></table></div></body></html>