From a4a5f562025a932cb17c178eedad8b07e8cf4cfa Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 3 Jun 1999 19:52:09 +0000 Subject: [PATCH] Add mention of FOR UPDATE and LIMIT/OFFSET> --- doc/src/sgml/ref/select.sgml | 13 +++++++++++++ src/bin/psql/psqlHelp.h | 6 ++++-- src/man/select.l | 12 ++++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 9b49285b49..110ec117c2 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -26,6 +26,8 @@ SELECT [ALL|DISTINCT [ON column] ] [ HAVING condition [, ...] ] [ { UNION [ALL] | INTERSECT | EXCEPT } select ] [ ORDER BY column [ ASC | DESC ] [, ...] ] + [ FOR UPDATE [OF class_name...]] + [ LIMIT count [OFFSET|, count]] @@ -242,6 +244,15 @@ including duplicates. The EXCEPT give you the rows in the upper query not in the lower query. (See EXCEPT clause). + + The FOR UPDATE clause allows the SELECT statement to perform + exclusive locking of selected rows. + (See EXCEPT clause). + + + The LIMIT...OFFSET clause allows control over which rows are + returned by the query. + You must have SELECT privilege to a table to read its values (See GRANT/REVOKE statements). @@ -709,6 +720,8 @@ SELECT [ ALL | DISTINCT ] expressioncondition [, ...] ] [ { UNION [ALL] | INTERSECT | EXCEPT } select] [ ORDER BY column [ ASC | DESC ] [, ...] ] + [ FOR UPDATE [OF class_name...]] + [ LIMIT count [OFFSET|, count]] diff --git a/src/bin/psql/psqlHelp.h b/src/bin/psql/psqlHelp.h index 507b0d54b4..a14154345a 100644 --- a/src/bin/psql/psqlHelp.h +++ b/src/bin/psql/psqlHelp.h @@ -5,7 +5,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: psqlHelp.h,v 1.67 1999/06/03 19:17:59 momjian Exp $ + * $Id: psqlHelp.h,v 1.68 1999/06/03 19:52:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -317,8 +317,10 @@ TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"}, \t[WHERE qual]\n\ \t[GROUP BY group_list]\n\ \t[HAVING having_clause]\n\ +\t[ { UNION [ALL] | INTERSECT | EXCEPT } SELECT ...]\n\ \t[ORDER BY attr1 [ASC|DESC] [USING op1], ...attrN ]\n\ -\t[ { UNION [ALL] | INTERSECT | EXCEPT } SELECT ...];"}, +\t[FOR UPDATE [OF class_name...]]\n\ +\t[LIMIT count [OFFSET|, count]];"}, {"set", "set run-time environment", "\ diff --git a/src/man/select.l b/src/man/select.l index 9de52c4749..10b11c906e 100644 --- a/src/man/select.l +++ b/src/man/select.l @@ -1,6 +1,6 @@ .\" This is -*-nroff-*- .\" XXX standard disclaimer belongs here.... -.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.12 1999/03/19 02:41:41 momjian Exp $ +.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.13 1999/06/03 19:52:09 momjian Exp $ .TH SELECT SQL 11/05/95 PostgreSQL PostgreSQL .SH NAME select - retrieve instances from a class @@ -14,8 +14,10 @@ select - retrieve instances from a class [\fBwhere\fR where-clause] [\fBgroup by\fR attr_name1 {, attr_name-i....}] [\fBhaving\fR having-clause] - [\fBorder by\fR attr_name1 [\fBasc\fR | \fBdesc\fR] [\fBusing op1\fR] {, attr_namei...}] [ { \fBunion {all}\fR | \fBintersect\fR | \fBexcept\fR } \fBselect\fR ...] + [\fBorder by\fR attr_name1 [\fBasc\fR | \fBdesc\fR] [\fBusing op1\fR] {, attr_namei...}] + [\fBfor update\fR [\fBof\fR class_name...]] + [\fBlimit\fR count [\fBoffset\fR|, count]] .fi .SH DESCRIPTION @@ -37,6 +39,12 @@ clause allows a user to specify that he wishes the instances sorted according to the corresponding operator. This operator must be a binary one returning a boolean. Multiple sort fields are allowed and are applied from left to right. +The +.BR "for update" +allows the select statement to perform exclusive locking of selected rows. +The +.BR "limit/offset" +allows control over which rows are returned by the query. .PP The target list specifies the fields to be retrieved. Each .IR attr_name