aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-12-01 16:38:59 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-12-01 16:38:59 -0500
commit15a5006aac1432da35ff6a7ae27a018ed300e860 (patch)
treeab856a4d496775fa9be5503d9c8e4fb999b68f89 /doc/src
parent3b86b4653c0635308a16ce0fade7209f1204832f (diff)
downloadpostgresql-15a5006aac1432da35ff6a7ae27a018ed300e860.tar.gz
postgresql-15a5006aac1432da35ff6a7ae27a018ed300e860.zip
Clarify documentation about SQL:2008 variant of LIMIT/OFFSET syntax.
The point that you need parentheses for non-constant expressions apparently needs to be brought out a bit more clearly, per bug #6315.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/select.sgml21
1 files changed, 12 insertions, 9 deletions
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index cc8cd48583a..39fc6b6d830 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -1064,7 +1064,8 @@ SELECT name FROM distributors ORDER BY code;
<synopsis>
LIMIT { <replaceable class="parameter">count</replaceable> | ALL }
OFFSET <replaceable class="parameter">start</replaceable>
-</synopsis><replaceable class="parameter">count</replaceable> specifies the
+</synopsis>
+ <replaceable class="parameter">count</replaceable> specifies the
maximum number of rows to return, while <replaceable
class="parameter">start</replaceable> specifies the number of rows
to skip before starting to return rows. When both are specified,
@@ -1087,17 +1088,19 @@ OFFSET <replaceable class="parameter">start</replaceable>
OFFSET <replaceable class="parameter">start</replaceable> { ROW | ROWS }
FETCH { FIRST | NEXT } [ <replaceable class="parameter">count</replaceable> ] { ROW | ROWS } ONLY
</synopsis>
- According to the standard, the <literal>OFFSET</literal> clause must come
- before the <literal>FETCH</literal> clause if both are present; but
- <productname>PostgreSQL</> is laxer and allows either order.
+ In this syntax, to write anything except a simple integer constant for
+ <replaceable class="parameter">start</> or <replaceable
+ class="parameter">count</replaceable>, you must write parentheses
+ around it.
+ If <replaceable class="parameter">count</> is
+ omitted in a <literal>FETCH</> clause, it defaults to 1.
<literal>ROW</literal>
and <literal>ROWS</literal> as well as <literal>FIRST</literal>
and <literal>NEXT</literal> are noise words that don't influence
- the effects of these clauses. In this syntax, when using expressions
- other than simple constants for <replaceable class="parameter">start</>
- or <replaceable class="parameter">count</replaceable>, parentheses will be
- necessary in most cases. If <replaceable class="parameter">count</> is
- omitted in <literal>FETCH</>, it defaults to 1.
+ the effects of these clauses.
+ According to the standard, the <literal>OFFSET</literal> clause must come
+ before the <literal>FETCH</literal> clause if both are present; but
+ <productname>PostgreSQL</> is laxer and allows either order.
</para>
<para>