Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit92b9e43

Browse files
committed
Clarify documentation about SQL:2008 variant of LIMIT/OFFSET syntax.
The point that you need parentheses for non-constant expressions apparentlyneeds to be brought out a bit more clearly, per bug #6315.
1 parenta03c47c commit92b9e43

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

‎doc/src/sgml/ref/select.sgml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,8 @@ SELECT name FROM distributors ORDER BY code;
10631063
<synopsis>
10641064
LIMIT { <replaceable class="parameter">count</replaceable> | ALL }
10651065
OFFSET <replaceable class="parameter">start</replaceable>
1066-
</synopsis><replaceable class="parameter">count</replaceable> specifies the
1066+
</synopsis>
1067+
<replaceable class="parameter">count</replaceable> specifies the
10671068
maximum number of rows to return, while <replaceable
10681069
class="parameter">start</replaceable> specifies the number of rows
10691070
to skip before starting to return rows. When both are specified,
@@ -1086,17 +1087,19 @@ OFFSET <replaceable class="parameter">start</replaceable>
10861087
OFFSET <replaceable class="parameter">start</replaceable> { ROW | ROWS }
10871088
FETCH { FIRST | NEXT } [ <replaceable class="parameter">count</replaceable> ] { ROW | ROWS } ONLY
10881089
</synopsis>
1089-
According to the standard, the <literal>OFFSET</literal> clause must come
1090-
before the <literal>FETCH</literal> clause if both are present; but
1091-
<productname>PostgreSQL</> is laxer and allows either order.
1090+
In this syntax, to write anything except a simple integer constant for
1091+
<replaceable class="parameter">start</> or <replaceable
1092+
class="parameter">count</replaceable>, you must write parentheses
1093+
around it.
1094+
If <replaceable class="parameter">count</> is
1095+
omitted in a <literal>FETCH</> clause, it defaults to 1.
10921096
<literal>ROW</literal>
10931097
and <literal>ROWS</literal> as well as <literal>FIRST</literal>
10941098
and <literal>NEXT</literal> are noise words that don't influence
1095-
the effects of these clauses. In this syntax, when using expressions
1096-
other than simple constants for <replaceable class="parameter">start</>
1097-
or <replaceable class="parameter">count</replaceable>, parentheses will be
1098-
necessary in most cases. If <replaceable class="parameter">count</> is
1099-
omitted in <literal>FETCH</>, it defaults to 1.
1099+
the effects of these clauses.
1100+
According to the standard, the <literal>OFFSET</literal> clause must come
1101+
before the <literal>FETCH</literal> clause if both are present; but
1102+
<productname>PostgreSQL</> is laxer and allows either order.
11001103
</para>
11011104

11021105
<para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp