From 048efc25e46d95f6a6dad20d65f6d9dd10c640d4 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 24 Oct 2007 23:27:08 +0000 Subject: Disallow scrolling of FOR UPDATE/FOR SHARE cursors, so as to avoid problems in corner cases such as re-fetching a just-deleted row. We may be able to relax this someday, but let's find out how many people really care before we invest a lot of work in it. Per report from Heikki and subsequent discussion. While in the neighborhood, make the combination of INSENSITIVE and FOR UPDATE throw an error, since they are semantically incompatible. (Up to now we've accepted but just ignored the INSENSITIVE option of DECLARE CURSOR.) --- doc/src/sgml/ref/declare.sgml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/declare.sgml b/doc/src/sgml/ref/declare.sgml index f823cf77bbe..269d2c101c4 100644 --- a/doc/src/sgml/ref/declare.sgml +++ b/doc/src/sgml/ref/declare.sgml @@ -1,5 +1,5 @@ @@ -172,7 +172,7 @@ DECLARE name [ BINARY ] [ INSENSITI transaction. Thus, DECLARE without WITH HOLD is useless outside a transaction block: the cursor would survive only to the completion of the statement. Therefore - PostgreSQL reports an error if this + PostgreSQL reports an error if such a command is used outside a transaction block. Use , @@ -230,6 +230,11 @@ DECLARE name [ BINARY ] [ INSENSITI will have no effect if the row was changed meanwhile. + + SCROLL may not be specified when the query + includes FOR UPDATE or FOR SHARE. + + The SQL standard only makes provisions for cursors in embedded SQL. The PostgreSQL @@ -265,10 +270,11 @@ DECLARE liahona CURSOR FOR SELECT * FROM films; Compatibility - The SQL standard specifies that by default, cursors are sensitive to - concurrent updates of the underlying data. In + The SQL standard says that it is implementation-dependent whether cursors + are sensitive to concurrent updates of the underlying data by default. In PostgreSQL, cursors are insensitive by default, - and can be made sensitive by specifying FOR UPDATE. + and can be made sensitive by specifying FOR UPDATE. Other + products may work differently. -- cgit v1.2.3