diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-12-30 21:45:37 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-12-30 21:45:37 +0000 |
| commit | 883ac5ca7a2a8160549223be99d4d0c17ac128a6 (patch) | |
| tree | dc8c3f07e384dab33ed1bfc74f2d57e3fbddfb11 /doc/src/sgml/plpython.sgml | |
| parent | 1fbdb6bc9f7740ab0d5a3495efa20c1ef522258a (diff) | |
| download | postgresql-883ac5ca7a2a8160549223be99d4d0c17ac128a6.tar.gz | |
More minor updates and copy-editing.
Diffstat (limited to 'doc/src/sgml/plpython.sgml')
| -rw-r--r-- | doc/src/sgml/plpython.sgml | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml index a3d64bd353..32fce8c4c6 100644 --- a/doc/src/sgml/plpython.sgml +++ b/doc/src/sgml/plpython.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/plpython.sgml,v 1.25 2004/12/17 02:14:44 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/plpython.sgml,v 1.26 2004/12/30 21:45:36 tgl Exp $ --> <chapter id="plpython"> <title>PL/Python - Python Procedural Language</title> @@ -46,15 +46,16 @@ <title>PL/Python Functions</title> <para> - The Python code you write gets transformed into a Python function. - For example, + Functions in PL/Python are declared in the usual way, for example <programlisting> CREATE FUNCTION myfunc(text) RETURNS text AS 'return args[0]' LANGUAGE plpythonu; </programlisting> - gets transformed into + The Python code that is given as the body of the function definition + gets transformed into a Python function. + For example, the above results in <programlisting> def __plpython_procedure_myfunc_23456(): @@ -151,19 +152,23 @@ def __plpython_procedure_myfunc_23456(): <literal>plpy.notice(<replaceable>msg</>)</literal>, <literal>plpy.warning(<replaceable>msg</>)</literal>, <literal>plpy.error(<replaceable>msg</>)</literal>, and - <literal>plpy.fatal(<replaceable>msg</>)</literal>. - These are mostly equivalent to calling - <literal>elog(<replaceable>level</>, <replaceable>msg</>)</literal> - from C code.<indexterm><primary>elog</><secondary>in - PL/Python</></indexterm> <function>plpy.error</function> and + <literal>plpy.fatal(<replaceable>msg</>)</literal>.<indexterm><primary>elog</><secondary>in PL/Python</></indexterm> + <function>plpy.error</function> and <function>plpy.fatal</function> actually raise a Python exception - which, if uncaught, causes the PL/Python module to call - <literal>elog(ERROR, msg)</literal> when the function handler - returns from the Python interpreter. <literal>raise - plpy.ERROR(<replaceable>msg</>)</literal> and <literal>raise - plpy.FATAL(<replaceable>msg</>)</literal> are equivalent to calling + which, if uncaught, propagates out to the calling query, causing + the current transaction or subtransaction to be aborted. + <literal>raise plpy.ERROR(<replaceable>msg</>)</literal> and + <literal>raise plpy.FATAL(<replaceable>msg</>)</literal> are + equivalent to calling <function>plpy.error</function> and <function>plpy.fatal</function>, respectively. + The other functions only generate messages of different + priority levels. + Whether messages of a particular priority are reported to the client, + written to the server log, or both is controlled by the + <xref linkend="guc-log-min-messages"> and + <xref linkend="guc-client-min-messages"> configuration + variables. See <xref linkend="runtime-config"> for more information. </para> <para> |
