Remove LIMIT #,# and suggest LIMIT # OFFSET #, per mailing list discussion.
authorBruce Momjian
Sat, 20 Oct 2001 02:55:39 +0000 (02:55 +0000)
committerBruce Momjian
Sat, 20 Oct 2001 02:55:39 +0000 (02:55 +0000)
HISTORY
doc/src/sgml/ref/select.sgml
doc/src/sgml/sql.sgml
src/backend/parser/gram.y
src/test/regress/expected/limit.out
src/test/regress/sql/limit.sql

diff --git a/HISTORY b/HISTORY
index 118d564420c95bd14754f5502a453bc0cd443a68..0b4bf863463949f4f6ff6ddab861dbce5882cc43 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -38,9 +38,8 @@ Migration to 7.2
 
    A dump/restore using pg_dump is required for those wishing to migrate
    data from any previous release.  One significant change is that
-   SELECT ... LIMIT 10,20 now uses the 10 as the OFFSET and the 20 as
-   the LIMIT.  Previous versions had this reversed.  This change was
-   made for MySQL compatibility.
+   the SELECT ... LIMIT 10,20 syntax is no longer supported.  You must
+   now use LIMIT 10 OFFSET 20 to accomplish the same thing.
 
 
 
index e8dc02498ca989d571d1aea7dc12055dc4861431..93a491a3286edb9c4cb4943368e164fc28a63d3f 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -29,7 +29,7 @@ SELECT [ ALL | DISTINCT [ ON ( expression
     [ { UNION | INTERSECT | EXCEPT [ ALL ] } select ]
     [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
     [ FOR UPDATE [ OF tablename [, ...] ] ]
-    [ LIMIT start , ] count | ALL } ]
+    [ LIMIT { count | ALL } ]
     [ OFFSET start ]
 
 where from_item can be:
@@ -614,7 +614,7 @@ SELECT name FROM distributors ORDER BY code;
     
 table_query UNION [ ALL ] table_query
     [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
-    [ LIMIT start , ] count | ALL } ]
+    [ LIMIT { count | ALL } ]
     [ OFFSET start ]
     
 
@@ -664,7 +664,7 @@ SELECT name FROM distributors ORDER BY code;
     
 table_query INTERSECT [ ALL ] table_query
     [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
-    [ LIMIT start , ] count | ALL } ]
+    [ LIMIT { count | ALL } ]
     [ OFFSET start ]
     
     
@@ -705,7 +705,7 @@ SELECT name FROM distributors ORDER BY code;
     
 table_query EXCEPT [ ALL ] table_query
     [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
-    [ LIMIT start , ] count | ALL } ]
+    [ LIMIT { count | ALL } ]
     [ OFFSET start ]
     
     
@@ -742,7 +742,7 @@ SELECT name FROM distributors ORDER BY code;
    
    
     
-    LIMIT start , ] count | ALL }
+    LIMIT { count | ALL }
     OFFSET start
     
     
index 223aee1bc692ca8325115a9fb1fda2020c9b7299..8ea411f36f0ca257024a147d5f7548d7c75f9a08 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -864,7 +864,7 @@ SELECT [ ALL | DISTINCT [ ON ( expression
     [ { UNION | INTERSECT | EXCEPT [ ALL ] } select ]
     [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
     [ FOR UPDATE [ OF class_name [, ...] ] ]
-    [ LIMIT start , ] count | ALL } ]
+    [ LIMIT { count | ALL } ]
     [ OFFSET start ]
      
     
index 4f5f5d6b7e8fb26ffa7f735c4d9657ae41c5e758..0db5bcd71410221764f1032d268538fedc4d5ed3 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.265 2001/10/20 01:02:14 thomas Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.266 2001/10/20 02:55:39 momjian Exp $
  *
  * HISTORY
  *   AUTHOR            DATE            MAJOR EVENT
@@ -3648,7 +3648,7 @@ OptUseOp:  USING all_Op                           { $$ = $2; }
 
 
 select_limit:  LIMIT select_offset_value ',' select_limit_value
-           { $$ = makeList2($2, $4); }
+           { elog(ERROR,"LIMIT #,# syntax no longer supported.  Use LIMIT # OFFSET #."); }
        | LIMIT select_limit_value OFFSET select_offset_value
            { $$ = makeList2($4, $2); }
        | LIMIT select_limit_value
index c99e0941567567d6253b88523b0fbfff4bbf910b..f960958b2f6d5d0e9992a6c4810d4ee1d7f058b1 100644 (file)
@@ -98,7 +98,7 @@ SELECT ''::text AS five, unique1, unique2, stringu1
 
 SELECT ''::text AS five, unique1, unique2, stringu1 
        FROM onek
-       ORDER BY unique1 LIMIT 900, 5;
+       ORDER BY unique1 LIMIT 5 OFFSET 900;
  five | unique1 | unique2 | stringu1 
 ------+---------+---------+----------
       |     900 |     913 | QIAAAA
index 99842af2f6a309c2fccc7595be5cf5358730c92f..c15a486aff9cdba7d1e7b504539b73e2aadbf883 100644 (file)
@@ -29,4 +29,4 @@ SELECT ''::text AS five, unique1, unique2, stringu1
        ORDER BY unique1 OFFSET 990 LIMIT 5;
 SELECT ''::text AS five, unique1, unique2, stringu1 
        FROM onek
-       ORDER BY unique1 LIMIT 900, 5;
+       ORDER BY unique1 LIMIT 5 OFFSET 900;