From: John B. <bel...@cs...> - 2001-08-04 19:36:13
|
Hi, Mark O. found a bug in the syntax for FIRST/SKIP that has resulting in a small syntax change. The bug is as follows: in the query "SELECT LIMIT 5 * FROM MESSAGES" the parser was treating '5 * FROM' as a multiplication equation. It would generate an error because FROM is not valid in the equation. The new syntax is slightly changed: SELECT [LIMIT X | LIMIT ? | LIMIT ( expression )] [SKIP X | SKIP ? | SKIP ( expression )] .... The difference is now X can only be a long integer constant, not a full expression (ie, equation). If you want to use an equation or anything other than a bind variable or integer constant you *must* include the parens. That is the change. 'SELECT LIMIT 5 * FROM MESSAGES' now works (and the syntax for that query is unchanged). But the syntax for 'SELECT LIMIT 5*4 SKIP 1+5*3 * FROM MESSAGES' (notice how the bug is easy to spot here) is now 'SELECT LIMIT (5*4) SKIP (1+5*3) * FROM MESSAGES' >> SELECT [FIRST X] [SKIP X] [DISTINCT | ALL] .... >> >> all indicies are 1 based. The new SQL keywords introduced are FIRST >> and SKIP. > > Both FIRST and SKIP work on their own. Combining both FIRST and SKIP > gives you limit functionality. -John |