aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-04-05 18:05:46 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-04-05 18:05:46 +0000
commit726220fb9faad7dc6ec32990f52180f4c9b6966e (patch)
tree8f9fd970f920521081aede4fe02797a746eaf846 /doc/src
parentfd97cf4df04e7a0a310b8d364d71958ff868d287 (diff)
downloadpostgresql-726220fb9faad7dc6ec32990f52180f4c9b6966e.tar.gz
postgresql-726220fb9faad7dc6ec32990f52180f4c9b6966e.zip
Adjust grammar for plpgsql's OPEN command so that a cursor can be
OPENed on non-SELECT commands such as EXPLAIN or SHOW (anything that returns tuples is allowed). This flexibility already existed for bound cursors, but OPEN was artificially restricting what it would take. Per a gripe some months back.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/plpgsql.sgml18
1 files changed, 10 insertions, 8 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index bd6f0254c3a..3ea1ac19b2d 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.63 2005/04/05 06:22:14 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.64 2005/04/05 18:05:45 tgl Exp $
-->
<chapter id="plpgsql">
@@ -2179,19 +2179,21 @@ DECLARE
</para>
<sect3>
- <title><command>OPEN FOR SELECT</command></title>
+ <title><command>OPEN FOR</command> <replaceable>query</replaceable></title>
<synopsis>
-OPEN <replaceable>unbound_cursor</replaceable> FOR SELECT ...;
+OPEN <replaceable>unbound_cursor</replaceable> FOR <replaceable>query</replaceable> ;
</synopsis>
<para>
- The cursor variable is opened and given the specified query to
+ The cursor variable is opened and given the specified query to
execute. The cursor cannot be open already, and it must have been
declared as an unbound cursor (that is, as a simple
- <type>refcursor</> variable). The <command>SELECT</command> query
- is treated in the same way as other <command>SELECT</command>
- statements in <application>PL/pgSQL</>: <application>PL/pgSQL</>
+ <type>refcursor</> variable). The query must be a
+ <command>SELECT</command>, or something else that returns rows
+ (such as <command>EXPLAIN</>). The query
+ is treated in the same way as other SQL commands in
+ <application>PL/pgSQL</>: <application>PL/pgSQL</>
variable names are substituted, and the query plan is cached for
possible reuse.
</para>
@@ -2216,7 +2218,7 @@ OPEN <replaceable>unbound_cursor</replaceable> FOR EXECUTE <replaceable class="c
execute. The cursor cannot be open already, and it must have been
declared as an unbound cursor (that is, as a simple
<type>refcursor</> variable). The query is specified as a string
- expression in the same way as in the <command>EXECUTE</command>
+ expression, in the same way as in the <command>EXECUTE</command>
command. As usual, this gives flexibility so the query can vary
from one run to the next.
</para>