From: Tom Lane Date: Mon, 2 Feb 2009 20:42:57 +0000 (+0000) Subject: Document the longstanding behavior of LIMIT NULL and OFFSET NULL, X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=0b64c295b6f3dd70a18d9b18e2f58fdea1ff6fa4;p=users%2Fsimon%2Fpostgres.git Document the longstanding behavior of LIMIT NULL and OFFSET NULL, per gripe from David Wheeler that this was mentioned nowhere. In passing, editorialize a bit on the description of the SQL:2008 equivalent syntax. --- diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index a7a6f79eb1..030dc3c890 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -1002,6 +1002,13 @@ OFFSET start class="parameter">count rows to be returned. + + If the count expression + evaluates to NULL, it is treated as LIMIT ALL, i.e., no + limit. If start evaluates + to NULL, it is treated the same as OFFSET 0. + + SQL:2008 introduced a different syntax to achieve the same thing, which PostgreSQL also supports. It is: @@ -1014,10 +1021,11 @@ FETCH { FIRST | NEXT } [ count ] { the FETCH clause. ROW and ROWS as well as FIRST and NEXT 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 start + or count, parentheses will be + necessary in most cases. If count is + omitted in FETCH, it defaults to 1.