summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/plpython.html
blob: ecaf7e5b2c96e88bc5feb24bb06b3342caba57a2 (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
<?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-funcs.html" title="46.1. PL/Python Functions" /></head><body id="docContent" class="container-fluid col-10"><div 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 15.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="plpython-funcs.html" title="46.1. PL/Python Functions">Next</a></td></tr></table><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-funcs.html">46.1. PL/Python Functions</a></span></dt><dt><span class="sect1"><a href="plpython-data.html">46.2. Data Values</a></span></dt><dd><dl><dt><span class="sect2"><a href="plpython-data.html#id-1.8.11.10.3">46.2.1. Data Type Mapping</a></span></dt><dt><span class="sect2"><a href="plpython-data.html#id-1.8.11.10.4">46.2.2. Null, None</a></span></dt><dt><span class="sect2"><a href="plpython-data.html#PLPYTHON-ARRAYS">46.2.3. Arrays, Lists</a></span></dt><dt><span class="sect2"><a href="plpython-data.html#id-1.8.11.10.6">46.2.4. Composite Types</a></span></dt><dt><span class="sect2"><a href="plpython-data.html#id-1.8.11.10.7">46.2.5. Set-Returning Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="plpython-sharing.html">46.3. Sharing Data</a></span></dt><dt><span class="sect1"><a href="plpython-do.html">46.4. Anonymous Code Blocks</a></span></dt><dt><span class="sect1"><a href="plpython-trigger.html">46.5. Trigger Functions</a></span></dt><dt><span class="sect1"><a href="plpython-database.html">46.6. Database Access</a></span></dt><dd><dl><dt><span class="sect2"><a href="plpython-database.html#id-1.8.11.14.3">46.6.1. Database Access Functions</a></span></dt><dt><span class="sect2"><a href="plpython-database.html#PLPYTHON-TRAPPING">46.6.2. Trapping Errors</a></span></dt></dl></dd><dt><span class="sect1"><a href="plpython-subtransaction.html">46.7. Explicit Subtransactions</a></span></dt><dd><dl><dt><span class="sect2"><a href="plpython-subtransaction.html#id-1.8.11.15.3">46.7.1. Subtransaction Context Managers</a></span></dt></dl></dd><dt><span class="sect1"><a href="plpython-transactions.html">46.8. Transaction Management</a></span></dt><dt><span class="sect1"><a href="plpython-util.html">46.9. Utility Functions</a></span></dt><dt><span class="sect1"><a href="plpython-python23.html">46.10. Python 2 vs. Python 3</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 plpython3u</code>.
 </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">plpython3u</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">plpython3u</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 class="navfooter"><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-funcs.html" title="46.1. PL/Python Functions">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 15.4 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 46.1. PL/Python Functions</td></tr></table></div></body></html>