From 11706ed6a0b1a8e1decf246b6c23e5805be3d8cf Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 18 Jun 2009 10:22:09 +0000 Subject: [PATCH] Refine the use of terminology around bound and unbound cursors and cursor variables. Remove the confusing term "reference cursor". --- doc/src/sgml/plpgsql.sgml | 14 +++++++------- src/include/catalog/pg_type.h | 2 +- src/pl/plpgsql/src/gram.y | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 80dbf45327..07078e6aea 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -2450,7 +2450,7 @@ DECLARE - Bound cursors can also be used without explicitly opening them, + Bound cursor variables can also be used without explicitly opening the cursor, via the FOR statement described in . @@ -2460,13 +2460,13 @@ DECLARE <command>OPEN FOR</command> <replaceable>query</replaceable> -OPEN unbound_cursor NO SCROLL FOR query; +OPEN unbound_cursorvar NO SCROLL FOR query; 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 + declared as an unbound cursor variable (that is, as a simple refcursor variable). The query must be a SELECT, or something else that returns rows (such as EXPLAIN). The query @@ -2494,13 +2494,13 @@ OPEN curs1 FOR SELECT * FROM foo WHERE key = mykey; <command>OPEN FOR EXECUTE</command> -OPEN unbound_cursor NO SCROLL FOR EXECUTE query_string; +OPEN unbound_cursorvar NO SCROLL FOR EXECUTE query_string; 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 + declared as an unbound cursor variable (that is, as a simple refcursor variable). The query is specified as a string expression, in the same way as in the EXECUTE 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); Opening a Bound Cursor -OPEN bound_cursor ( argument_values ) ; +OPEN bound_cursorvar ( argument_values ) ; @@ -2850,7 +2850,7 @@ COMMIT; <<label>> -FOR recordvar IN bound_cursor ( argument_values ) LOOP +FOR recordvar IN bound_cursorvar ( argument_values ) LOOP statements END LOOP label ; diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 6128097a3a..1b8c34a3d2 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -520,7 +520,7 @@ DESCR("numeric(precision, decimal), arbitrary precision number"); #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_ )); -DESCR("reference cursor (portal name)"); +DESCR("reference to cursor (portal name)"); #define REFCURSOROID 1790 /* OIDS 2200 - 2299 */ diff --git a/src/pl/plpgsql/src/gram.y b/src/pl/plpgsql/src/gram.y index 06704cf593..c271bcedb5 100644 --- a/src/pl/plpgsql/src/gram.y +++ b/src/pl/plpgsql/src/gram.y @@ -1585,7 +1585,7 @@ stmt_open : K_OPEN lno cursor_variable (errcode(ERRCODE_SYNTAX_ERROR), errmsg("syntax error at \"%s\"", yytext), - errdetail("Expected \"FOR\", to open a reference cursor."))); + errdetail("Expected \"FOR\", to open a cursor for an unbound cursor variable."))); } tok = yylex(); -- 2.30.2