Refine the use of terminology around bound and unbound cursors and cursor
variables. Remove the confusing term "reference cursor".
This commit is contained in:
parent
efa8544fd5
commit
12bc87e09b
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.141 2009/05/02 17:27:57 tgl Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.142 2009/06/18 10:22:08 petere Exp $ -->
|
||||||
|
|
||||||
<chapter id="plpgsql">
|
<chapter id="plpgsql">
|
||||||
<title><application>PL/pgSQL</application> - <acronym>SQL</acronym> Procedural Language</title>
|
<title><application>PL/pgSQL</application> - <acronym>SQL</acronym> Procedural Language</title>
|
||||||
@ -2450,7 +2450,7 @@ DECLARE
|
|||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
Bound cursors can also be used without explicitly opening them,
|
Bound cursor variables can also be used without explicitly opening the cursor,
|
||||||
via the <command>FOR</> statement described in
|
via the <command>FOR</> statement described in
|
||||||
<xref linkend="plpgsql-cursor-for-loop">.
|
<xref linkend="plpgsql-cursor-for-loop">.
|
||||||
</para>
|
</para>
|
||||||
@ -2460,13 +2460,13 @@ DECLARE
|
|||||||
<title><command>OPEN FOR</command> <replaceable>query</replaceable></title>
|
<title><command>OPEN FOR</command> <replaceable>query</replaceable></title>
|
||||||
|
|
||||||
<synopsis>
|
<synopsis>
|
||||||
OPEN <replaceable>unbound_cursor</replaceable> <optional> <optional> NO </optional> SCROLL </optional> FOR <replaceable>query</replaceable>;
|
OPEN <replaceable>unbound_cursorvar</replaceable> <optional> <optional> NO </optional> SCROLL </optional> FOR <replaceable>query</replaceable>;
|
||||||
</synopsis>
|
</synopsis>
|
||||||
|
|
||||||
<para>
|
<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
|
execute. The cursor cannot be open already, and it must have been
|
||||||
declared as an unbound cursor (that is, as a simple
|
declared as an unbound cursor variable (that is, as a simple
|
||||||
<type>refcursor</> variable). The query must be a
|
<type>refcursor</> variable). The query must be a
|
||||||
<command>SELECT</command>, or something else that returns rows
|
<command>SELECT</command>, or something else that returns rows
|
||||||
(such as <command>EXPLAIN</>). The query
|
(such as <command>EXPLAIN</>). The query
|
||||||
@ -2494,13 +2494,13 @@ OPEN curs1 FOR SELECT * FROM foo WHERE key = mykey;
|
|||||||
<title><command>OPEN FOR EXECUTE</command></title>
|
<title><command>OPEN FOR EXECUTE</command></title>
|
||||||
|
|
||||||
<synopsis>
|
<synopsis>
|
||||||
OPEN <replaceable>unbound_cursor</replaceable> <optional> <optional> NO </optional> SCROLL </optional> FOR EXECUTE <replaceable class="command">query_string</replaceable>;
|
OPEN <replaceable>unbound_cursorvar</replaceable> <optional> <optional> NO </optional> SCROLL </optional> FOR EXECUTE <replaceable class="command">query_string</replaceable>;
|
||||||
</synopsis>
|
</synopsis>
|
||||||
|
|
||||||
<para>
|
<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
|
execute. The cursor cannot be open already, and it must have been
|
||||||
declared as an unbound cursor (that is, as a simple
|
declared as an unbound cursor variable (that is, as a simple
|
||||||
<type>refcursor</> variable). The query is specified as a string
|
<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 plan can vary
|
command. As usual, this gives flexibility so the query plan can vary
|
||||||
@ -2524,7 +2524,7 @@ OPEN curs1 FOR EXECUTE 'SELECT * FROM ' || quote_ident($1);
|
|||||||
<title>Opening a Bound Cursor</title>
|
<title>Opening a Bound Cursor</title>
|
||||||
|
|
||||||
<synopsis>
|
<synopsis>
|
||||||
OPEN <replaceable>bound_cursor</replaceable> <optional> ( <replaceable>argument_values</replaceable> ) </optional>;
|
OPEN <replaceable>bound_cursorvar</replaceable> <optional> ( <replaceable>argument_values</replaceable> ) </optional>;
|
||||||
</synopsis>
|
</synopsis>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -2850,7 +2850,7 @@ COMMIT;
|
|||||||
|
|
||||||
<synopsis>
|
<synopsis>
|
||||||
<optional> <<<replaceable>label</replaceable>>> </optional>
|
<optional> <<<replaceable>label</replaceable>>> </optional>
|
||||||
FOR <replaceable>recordvar</replaceable> IN <replaceable>bound_cursor</replaceable> <optional> ( <replaceable>argument_values</replaceable> ) </optional> LOOP
|
FOR <replaceable>recordvar</replaceable> IN <replaceable>bound_cursorvar</replaceable> <optional> ( <replaceable>argument_values</replaceable> ) </optional> LOOP
|
||||||
<replaceable>statements</replaceable>
|
<replaceable>statements</replaceable>
|
||||||
END LOOP <optional> <replaceable>label</replaceable> </optional>;
|
END LOOP <optional> <replaceable>label</replaceable> </optional>;
|
||||||
</synopsis>
|
</synopsis>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.205 2009/06/11 14:49:10 momjian Exp $
|
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.206 2009/06/18 10:22:09 petere Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* the genbki.sh script reads this file and generates .bki
|
* the genbki.sh script reads this file and generates .bki
|
||||||
@ -520,7 +520,7 @@ DESCR("numeric(precision, decimal), arbitrary precision number");
|
|||||||
#define NUMERICOID 1700
|
#define NUMERICOID 1700
|
||||||
|
|
||||||
DATA(insert OID = 1790 ( refcursor PGNSP PGUID -1 f b U f t \054 0 0 2201 textin textout textrecv textsend - - - i x f 0 -1 0 _null_ _null_ ));
|
DATA(insert OID = 1790 ( refcursor PGNSP PGUID -1 f b U f t \054 0 0 2201 textin textout textrecv textsend - - - i x f 0 -1 0 _null_ _null_ ));
|
||||||
DESCR("reference cursor (portal name)");
|
DESCR("reference to cursor (portal name)");
|
||||||
#define REFCURSOROID 1790
|
#define REFCURSOROID 1790
|
||||||
|
|
||||||
/* OIDS 2200 - 2299 */
|
/* OIDS 2200 - 2299 */
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.124 2009/05/01 23:57:34 tgl Exp $
|
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.125 2009/06/18 10:22:09 petere Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1585,7 +1585,7 @@ stmt_open : K_OPEN lno cursor_variable
|
|||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
errmsg("syntax error at \"%s\"",
|
errmsg("syntax error at \"%s\"",
|
||||||
yytext),
|
yytext),
|
||||||
errdetail("Expected \"FOR\", to open a reference cursor.")));
|
errdetail("Expected \"FOR\", to open a cursor for an unbound cursor variable.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
tok = yylex();
|
tok = yylex();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user