提交 0c6a8026 authored 作者: Noel Grandin's avatar Noel Grandin

Support OFFSET without LIMIT in SELECT

上级 00693b37
...@@ -7,7 +7,7 @@ SELECT [ TOP term ] [ DISTINCT | ALL ] selectExpression [,...] ...@@ -7,7 +7,7 @@ SELECT [ TOP term ] [ DISTINCT | ALL ] selectExpression [,...]
FROM tableExpression [,...] [ WHERE expression ] FROM tableExpression [,...] [ WHERE expression ]
[ GROUP BY expression [,...] ] [ HAVING expression ] [ GROUP BY expression [,...] ] [ HAVING expression ]
[ { UNION [ ALL ] | MINUS | EXCEPT | INTERSECT } select ] [ ORDER BY order [,...] ] [ { UNION [ ALL ] | MINUS | EXCEPT | INTERSECT } select ] [ ORDER BY order [,...] ]
[ LIMIT expression [ OFFSET expression ] [ SAMPLE_SIZE rowCountInt ] ] [ [ LIMIT expression ] [ OFFSET expression ] [ SAMPLE_SIZE rowCountInt ] ]
[ FOR UPDATE ] [ FOR UPDATE ]
"," ","
Selects data from a table or multiple tables. Selects data from a table or multiple tables.
......
...@@ -21,6 +21,8 @@ Change Log ...@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>Support OFFSET without LIMIT in SELECT
</li>
<li>Improve error message for METHOD_NOT_FOUND_1/90087 <li>Improve error message for METHOD_NOT_FOUND_1/90087
</li> </li>
<li>CLOB and BLOB objects of removed rows were sometimes kept in the database file. <li>CLOB and BLOB objects of removed rows were sometimes kept in the database file.
......
...@@ -1774,7 +1774,7 @@ public class Parser { ...@@ -1774,7 +1774,7 @@ public class Parser {
if (readIf("OFFSET")) { if (readIf("OFFSET")) {
command.setOffset(readExpression().optimize(session)); command.setOffset(readExpression().optimize(session));
if (!readIf("ROW")) { if (!readIf("ROW")) {
read("ROWS"); readIf("ROWS");
} }
} }
if (readIf("FETCH")) { if (readIf("FETCH")) {
......
...@@ -6203,6 +6203,12 @@ SELECT * FROM TEST UNION ALL SELECT * FROM TEST ORDER BY ID LIMIT 2+0 OFFSET 1+0 ...@@ -6203,6 +6203,12 @@ SELECT * FROM TEST UNION ALL SELECT * FROM TEST ORDER BY ID LIMIT 2+0 OFFSET 1+0
> 2 World > 2 World
> rows (ordered): 2 > rows (ordered): 2
SELECT * FROM TEST ORDER BY ID OFFSET 4;
> ID NAME
> -- ---------
> 5 resources
> rows (ordered): 1
SELECT ID FROM TEST GROUP BY ID UNION ALL SELECT ID FROM TEST GROUP BY ID; SELECT ID FROM TEST GROUP BY ID UNION ALL SELECT ID FROM TEST GROUP BY ID;
> ID > ID
> -- > --
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论