Document the longstanding behavior of LIMIT NULL and OFFSET NULL,
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 2 Feb 2009 20:42:57 +0000 (20:42 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 2 Feb 2009 20:42:57 +0000 (20:42 +0000)
per gripe from David Wheeler that this was mentioned nowhere.
In passing, editorialize a bit on the description of the SQL:2008
equivalent syntax.

doc/src/sgml/ref/select.sgml

index a7a6f79eb1a5e46a6cce071ee1effcdb524f6bbe..030dc3c890ef56eb426a71d8a979b695471b43a1 100644 (file)
@@ -1002,6 +1002,13 @@ OFFSET <replaceable class="parameter">start</replaceable>
     class="parameter">count</replaceable> rows to be returned.
    </para>
 
+   <para>
+    If the <replaceable class="parameter">count</replaceable> expression
+    evaluates to NULL, it is treated as <literal>LIMIT ALL</>, i.e., no
+    limit.  If <replaceable class="parameter">start</replaceable> evaluates
+    to NULL, it is treated the same as <literal>OFFSET 0</>.
+   </para>
+
    <para>
     SQL:2008 introduced a different syntax to achieve the same thing,
     which PostgreSQL also supports.  It is:
@@ -1014,10 +1021,11 @@ FETCH { FIRST | NEXT } [ <replaceable class="parameter">count</replaceable> ] {
     the <literal>FETCH</literal> clause.  <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.  When using expressions other than
-    constants for the offset or fetch count, parentheses will be
-    necessary in most cases.  If the fetch count is omitted, it
-    defaults to 1.
+    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.
    </para>
 
    <para>