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

Commit15a5006

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 parent3b86b46 commit15a5006

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

11031106
<para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp