summaryrefslogtreecommitdiff
path: root/src/man
diff options
context:
space:
mode:
authorBruce Momjian1998-01-23 06:01:36 +0000
committerBruce Momjian1998-01-23 06:01:36 +0000
commit661bb388123420d70a8a78c55cc6fc81705b77c0 (patch)
tree84b2c3e390bb5728d46ae2d6a42db784688e7c37 /src/man
parentc487962dd7df883eaaba46a0697097c66c7ba781 (diff)
Cleanup deadlock message.
Diffstat (limited to 'src/man')
-rw-r--r--src/man/lock.l33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/man/lock.l b/src/man/lock.l
new file mode 100644
index 00000000000..8882cf15fb7
--- /dev/null
+++ b/src/man/lock.l
@@ -0,0 +1,33 @@
+.\" This is -*-nroff-*-
+.\" XXX standard disclaimer belongs here....
+.\" $Header: /cvsroot/pgsql/src/man/Attic/lock.l,v 1.1 1998/01/23 06:01:36 momjian Exp $
+.TH FETCH SQL 01/23/93 PostgreSQL PostgreSQL
+.SH NAME
+lock - exclusive lock a table
+.SH SYNOPSIS
+.nf
+\fBlock\fR classname
+.fi
+.SH DESCRIPTION
+.BR lock
+exclusive locks a table inside a transaction. The classic use for this
+is the case where you want to \fBselect\fP some data, then update it
+inside a transaction. If you don't exclusive lock the table before the
+\fBselect\fP, some other user may also read the selected data, and try
+and do their own \fBupdate\fP, causing a deadlock while you both wait
+for the other to release the \fBselect\fP-induced shared lock so you can
+get an exclusive lock to do the \fBupdate.\fP
+.SH EXAMPLES
+.nf
+--
+-- Proper locking to prevent deadlock
+--
+begin work;
+lock mytable;
+select * from mytable;
+update mytable set (x = 100);
+end work;
+.SH "SEE ALSO"
+begin(l),
+end(l),
+select(l).