Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
fb9bc342
Commit
fb9bc342
authored
Oct 18, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve discussion of FOR UPDATE.
parent
f99e525f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
doc/src/sgml/ref/select.sgml
doc/src/sgml/ref/select.sgml
+21
-7
No files found.
doc/src/sgml/ref/select.sgml
View file @
fb9bc342
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/select.sgml,v 1.6
1 2002/09/21 18:32:54 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/select.sgml,v 1.6
2 2002/10/18 18:26:22 tgl
Exp $
PostgreSQL documentation
-->
...
...
@@ -368,13 +368,14 @@ where <replaceable class="PARAMETER">from_item</replaceable> can be:
</para>
<para>
The FOR UPDATE clause
allows the SELECT statement to perform
exclusive locking of selected row
s.
The FOR UPDATE clause
causes the SELECT statement to lock the selected
rows against concurrent update
s.
</para>
<para>
You must have SELECT privilege to a table to read its values
(See the <command>GRANT</command>/<command>REVOKE</command> statements).
Use of FOR UPDATE requires UPDATE privilege as well.
</para>
<refsect2 id="SQL-FROM">
...
...
@@ -859,19 +860,32 @@ SELECT name FROM distributors ORDER BY code;
<para>
FOR UPDATE causes the rows retrieved by the query to be locked as though
for update. This prevents them from being modified or deleted by other
transactions until the current transaction ends.
transactions until the current transaction ends; that is, other
transactions that attempt UPDATE, DELETE, or SELECT FOR UPDATE of these
rows will be blocked until the current transaction ends. Also, if an
UPDATE, DELETE, or SELECT FOR UPDATE from another transaction has already
locked a selected row or rows, SELECT FOR UPDATE will wait for the other
transaction to complete, and will then lock and return the updated row
(or no row, if the row was deleted). For further discussion see the
concurrency chapter of the <citetitle>User's Guide</citetitle>.
</para>
<para>
If specific tables are named in FOR UPDATE, then only rows coming from
those tables are locked.
those tables are locked; any other tables used in the SELECT are simply
read as usual.
</para>
<para>
FOR UPDATE cannot be used in contexts where returned rows can't be clearly
identified with individual table rows; for example it can't be used with
aggregation. FOR UPDATE may also appear before LIMIT for portability with
pre-7.3 applications.
aggregation.
</para>
<para>
FOR UPDATE may appear before LIMIT for compatibility with
pre-7.3 applications. However, it effectively executes after LIMIT,
and so that is the recommended place to write it.
</para>
</refsect2>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment