summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-05-03 00:11:36 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-05-03 00:11:36 +0000
commit47391591ba6aa1c7153372f09d1f88c98a0165d4 (patch)
tree1536d266233ef4339c930679a9c003b9ad58d2cd /doc/src
parent511b798c466a98cf702ea35943cf03e9e109817b (diff)
Support RETURN QUERY EXECUTE in plpgsql.
Pavel Stehule
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/plpgsql.sgml12
1 files changed, 10 insertions, 2 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 8eac671fabf..1065eddc74e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.127 2008/04/06 23:43:29 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.128 2008/05/03 00:11:36 tgl Exp $ -->
<chapter id="plpgsql">
<title><application>PL/pgSQL</application> - <acronym>SQL</acronym> Procedural Language</title>
@@ -1467,6 +1467,7 @@ RETURN <replaceable>expression</replaceable>;
<synopsis>
RETURN NEXT <replaceable>expression</replaceable>;
RETURN QUERY <replaceable>query</replaceable>;
+RETURN QUERY EXECUTE <replaceable class="command">command-string</replaceable> <optional> USING <replaceable>expression</replaceable> <optional>, ...</optional> </optional>;
</synopsis>
<para>
@@ -1501,6 +1502,14 @@ RETURN QUERY <replaceable>query</replaceable>;
</para>
<para>
+ <command>RETURN QUERY</command> has a variant
+ <command>RETURN QUERY EXECUTE</command>, which specifies the
+ query to be executed dynamically. Parameter expressions can
+ be inserted into the computed query string via <literal>USING</>,
+ in just the same way as in the <command>EXECUTE</> command.
+ </para>
+
+ <para>
If you declared the function with output parameters, write just
<command>RETURN NEXT</command> with no expression. On each
execution, the current values of the output parameter
@@ -1544,7 +1553,6 @@ SELECT * FROM getallfoo();
Note that functions using <command>RETURN NEXT</command> or
<command>RETURN QUERY</command> must be called as a table source in
a <literal>FROM</literal> clause.
-
</para>
<note>