Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit51d2c9b

Browse files
committed
Add some documentation about PL/Python limitations
suggested by Steve White (bug #5272)
1 parentde66eff commit51d2c9b

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

‎doc/src/sgml/plpython.sgml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/plpython.sgml,v 1.47 2010/03/21 02:24:29 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/plpython.sgml,v 1.48 2010/03/29 21:20:58 petere Exp $ -->
22

33
<chapter id="plpython">
44
<title>PL/Python - Python Procedural Language</title>
@@ -243,7 +243,7 @@ $$ LANGUAGE plpythonu;
243243
</para>
244244
</sect1>
245245

246-
<sect1>
246+
<sect1 id="plpython-data">
247247
<title>Data Values</title>
248248
<para>
249249
Generally speaking, the aim of PL/Python is to provide
@@ -364,6 +364,18 @@ $$ LANGUAGE plpythonu;
364364
return type and the Python data type of the actual return object
365365
are not flagged; the value will be converted in any case.
366366
</para>
367+
368+
<tip>
369+
<para>
370+
<application>PL/Python</application> functions cannot return
371+
either type <type>RECORD</type> or <type>SETOF RECORD</type>. A
372+
workaround is to write a <application>PL/pgSQL</application>
373+
function that creates a temporary table, have it call the
374+
<application>PL/Python</application> function to fill the table,
375+
and then have the <application>PL/pgSQL</application> function
376+
return the generic <type>RECORD</type> from the temporary table.
377+
</para>
378+
</tip>
367379
</sect2>
368380

369381
<sect2>
@@ -866,6 +878,20 @@ rv = plpy.execute(plan, [ "name" ], 5)
866878
The third argument is the limit and is optional.
867879
</para>
868880

881+
<para>
882+
Query parameters and result row fields are converted between
883+
PostgreSQL and Python data types as described
884+
in <xref linkend="plpython-data">. The exception is that composite
885+
types are currently not supported: They will be rejected as query
886+
parameters and are converted to strings when appearing in a query
887+
result. As a workaround for the latter problem, the query can
888+
sometimes be rewritten so that the composite type result appears as
889+
a result row rather than as a field of the result row.
890+
Alternatively, the resulting string could be parsed apart by hand,
891+
but this approach is not recommended because it is not
892+
future-proof.
893+
</para>
894+
869895
<para>
870896
When you prepare a plan using the PL/Python module it is
871897
automatically saved. Read the SPI documentation (<xref

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp