Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a4a5f56

Browse files
committed
Add mention of FOR UPDATE and LIMIT/OFFSET>
1 parent e1ea7cc commit a4a5f56

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

doc/src/sgml/ref/select.sgml

+13
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ]
2626
[ HAVING <replaceable class="PARAMETER">condition</replaceable> [, ...] ]
2727
[ { UNION [ALL] | INTERSECT | EXCEPT } <replaceable class="PARAMETER">select</replaceable> ]
2828
[ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ]
29+
[ FOR UPDATE [OF class_name...]]
30+
[ LIMIT count [OFFSET|, count]]
2931
</synopsis>
3032

3133
<refsect2 id="R2-SQL-SELECT-1">
@@ -242,6 +244,15 @@ including duplicates.</para>
242244
The EXCEPT give you the rows in the upper query not in the lower query.
243245
(See EXCEPT clause).</para>
244246

247+
<para>
248+
The FOR UPDATE clause allows the SELECT statement to perform
249+
exclusive locking of selected rows.
250+
(See EXCEPT clause).</para>
251+
252+
<para>
253+
The LIMIT...OFFSET clause allows control over which rows are
254+
returned by the query.</para>
255+
245256
<para>
246257
You must have SELECT privilege to a table to read its values
247258
(See <command>GRANT</command>/<command>REVOKE</command> statements).
@@ -709,6 +720,8 @@ SELECT [ ALL | DISTINCT ] <replaceable class="PARAMETER">expression</replaceable
709720
[ HAVING <replaceable class="PARAMETER">condition</replaceable> [, ...] ]
710721
[ { UNION [ALL] | INTERSECT | EXCEPT } <replaceable class="PARAMETER">select</replaceable>]
711722
[ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ]
723+
[ FOR UPDATE [OF class_name...]]
724+
[ LIMIT count [OFFSET|, count]]
712725
</synopsis>
713726

714727
<refsect2 id="R2-SQL-SELECTINTO-1">

src/bin/psql/psqlHelp.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: psqlHelp.h,v 1.67 1999/06/03 19:17:59 momjian Exp $
8+
* $Id: psqlHelp.h,v 1.68 1999/06/03 19:52:08 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -317,8 +317,10 @@ TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"},
317317
\t[WHERE qual]\n\
318318
\t[GROUP BY group_list]\n\
319319
\t[HAVING having_clause]\n\
320+
\t[ { UNION [ALL] | INTERSECT | EXCEPT } SELECT ...]\n\
320321
\t[ORDER BY attr1 [ASC|DESC] [USING op1], ...attrN ]\n\
321-
\t[ { UNION [ALL] | INTERSECT | EXCEPT } SELECT ...];"},
322+
\t[FOR UPDATE [OF class_name...]]\n\
323+
\t[LIMIT count [OFFSET|, count]];"},
322324
{"set",
323325
"set run-time environment",
324326
"\

src/man/select.l

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.12 1999/03/19 02:41:41 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.13 1999/06/03 19:52:09 momjian Exp $
44
.TH SELECT SQL 11/05/95 PostgreSQL PostgreSQL
55
.SH NAME
66
select - retrieve instances from a class
@@ -14,8 +14,10 @@ select - retrieve instances from a class
1414
[\fBwhere\fR where-clause]
1515
[\fBgroup by\fR attr_name1 {, attr_name-i....}]
1616
[\fBhaving\fR having-clause]
17-
[\fBorder by\fR attr_name1 [\fBasc\fR | \fBdesc\fR] [\fBusing op1\fR] {, attr_namei...}]
1817
[ { \fBunion {all}\fR | \fBintersect\fR | \fBexcept\fR } \fBselect\fR ...]
18+
[\fBorder by\fR attr_name1 [\fBasc\fR | \fBdesc\fR] [\fBusing op1\fR] {, attr_namei...}]
19+
[\fBfor update\fR [\fBof\fR class_name...]]
20+
[\fBlimit\fR count [\fBoffset\fR|, count]]
1921

2022
.fi
2123
.SH DESCRIPTION
@@ -37,6 +39,12 @@ clause allows a user to specify that he wishes the instances sorted
3739
according to the corresponding operator. This operator must be a
3840
binary one returning a boolean. Multiple sort fields are allowed and
3941
are applied from left to right.
42+
The
43+
.BR "for update"
44+
allows the select statement to perform exclusive locking of selected rows.
45+
The
46+
.BR "limit/offset"
47+
allows control over which rows are returned by the query.
4048
.PP
4149
The target list specifies the fields to be retrieved. Each
4250
.IR attr_name

0 commit comments

Comments
 (0)