Re: Negative LIMIT and OFFSET? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Negative LIMIT and OFFSET?
Date
Msg-id 5443.1197867291@sss.pgh.pa.us
Whole thread Raw
In response to Re: Negative LIMIT and OFFSET?  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Negative LIMIT and OFFSET?  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
> Since we got LIMIT/OFFSET from MySQL, would someone tell us how MySQL
> behaves in these cases?

Not very well, at least not in mysql 5.0.45:

mysql> select * from t limit -2;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
versionfor the right syntax to use near '-2' at line 1
 
mysql> select * from t limit 2 offset -2;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
versionfor the right syntax to use near '-2' at line 1
 

This behavior suggests that they can't even deal with LIMIT/OFFSET
values that aren't simple integer literals ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Negative LIMIT and OFFSET?
Next
From: Gregory Stark
Date:
Subject: Re: Negative LIMIT and OFFSET?