diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-11 22:22:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-11 22:22:42 +0000 |
commit | a9545b3aef0d41fdb84bc6a30fa2e563020acad2 (patch) | |
tree | 4b6f9353cf6846a6b1ce2b96ddbf2ffbf2a42d58 /doc/src | |
parent | bdc71c2cb162297f7f69d8d2be113c2689f5bd6e (diff) |
Improve UPDATE/DELETE WHERE CURRENT OF so that they can be used from plpgsql
with a plpgsql-defined cursor. The underlying mechanism for this is that the
main SQL engine will now take "WHERE CURRENT OF $n" where $n is a refcursor
parameter. Not sure if we should document that fact or consider it an
implementation detail. Per discussion with Pavel Stehule.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/plpgsql.sgml | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 855b05c0ef8..18ba19dd776 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.111 2007/06/11 15:08:32 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.112 2007/06/11 22:22:40 tgl Exp $ --> <chapter id="plpgsql"> <title><application>PL/pgSQL</application> - <acronym>SQL</acronym> Procedural Language</title> @@ -2619,6 +2619,31 @@ MOVE RELATIVE -2 FROM curs4; </sect3> <sect3> + <title><literal>UPDATE/DELETE WHERE CURRENT OF</></title> + +<synopsis> +UPDATE <replaceable>table</replaceable> SET ... WHERE CURRENT OF <replaceable>cursor</replaceable>; +DELETE FROM <replaceable>table</replaceable> WHERE CURRENT OF <replaceable>cursor</replaceable>; +</synopsis> + + <para> + When a cursor is positioned on a table row, that row can be updated + or deleted using the cursor to identify the row. Note that this + only works for simple (non-join, non-grouping) cursor queries. + For additional information see the + <xref linkend="sql-declare" endterm="sql-declare-title"> + reference page. + </para> + + <para> + An example: +<programlisting> +UPDATE foo SET dataval = myval WHERE CURRENT OF curs1; +</programlisting> + </para> + </sect3> + + <sect3> <title><literal>CLOSE</></title> <synopsis> |