Skip to content

Commit da1eacb

Browse files
committed
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.
1 parent 698bb4e commit da1eacb

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

doc/src/sgml/ref/select.sgml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,17 +1056,19 @@ OFFSET <replaceable class="parameter">start</replaceable>
10561056
OFFSET <replaceable class="parameter">start</replaceable> { ROW | ROWS }
10571057
FETCH { FIRST | NEXT } [ <replaceable class="parameter">count</replaceable> ] { ROW | ROWS } ONLY
10581058
</synopsis>
1059-
According to the standard, the <literal>OFFSET</literal> clause must come
1060-
before the <literal>FETCH</literal> clause if both are present; but
1061-
<productname>PostgreSQL</> is laxer and allows either order.
1059+
In this syntax, to write anything except a simple integer constant for
1060+
<replaceable class="parameter">start</> or <replaceable
1061+
class="parameter">count</replaceable>, you must write parentheses
1062+
around it.
1063+
If <replaceable class="parameter">count</> is
1064+
omitted in a <literal>FETCH</> clause, it defaults to 1.
10621065
<literal>ROW</literal>
10631066
and <literal>ROWS</literal> as well as <literal>FIRST</literal>
10641067
and <literal>NEXT</literal> are noise words that don't influence
1065-
the effects of these clauses. In this syntax, when using expressions
1066-
other than simple constants for <replaceable class="parameter">start</>
1067-
or <replaceable class="parameter">count</replaceable>, parentheses will be
1068-
necessary in most cases. If <replaceable class="parameter">count</> is
1069-
omitted in <literal>FETCH</>, it defaults to 1.
1068+
the effects of these clauses.
1069+
According to the standard, the <literal>OFFSET</literal> clause must come
1070+
before the <literal>FETCH</literal> clause if both are present; but
1071+
<productname>PostgreSQL</> is laxer and allows either order.
10701072
</para>
10711073

10721074
<para>

0 commit comments

Comments
 (0)