diff --git a/TODO b/TODO index 623b2b4..7ba561e 100644 --- a/TODO +++ b/TODO @@ -3,23 +3,6 @@ next release: review tests to copy from hssqlppp -group by extensions. Question: some of the syntax can be represented - by app and row ctor, should this be reused or new syntax created - (the standard has special grammar for cube and rollup). - -SELECT EmpId, Yr, SUM(Sales) AS Sales -FROM Sales -GROUP BY GROUPING SETS((EmpId, Yr), (EmpId), ()) - -SELECT EmpId, Yr, SUM(Sales) AS Sales -FROM Sales -GROUP BY GROUPING SETS((EmpId, Yr), (EmpId)) - -{ (grouping_column[, ...]) | ROLLUP (grouping_column[, ...]) | -CUBE (grouping_column[, ...]) | GROUPING SETS (grouping_set_list) | -( ) | grouping_set, grouping_set_list } - - collate? -> postfix operator which binds very tightly: a < 'foo' collate 'C' -> diff --git a/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs b/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs index 521bc8f..1384ccc 100644 --- a/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs +++ b/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs @@ -19,7 +19,7 @@ These are a few misc tests which don't fit anywhere else. > ,whereClause > ,having > ,orderBy -> ,limit +> ,offsetFetch > ,combos > ,withQueries > ,values @@ -112,8 +112,8 @@ These are a few misc tests which don't fit anywhere else. > ,qeFrom = [TRSimple "t"] > ,qeOrderBy = o} -> limit :: TestItem -> limit = Group "limit" $ map (uncurry TestQueryExpr) +> offsetFetch :: TestItem +> offsetFetch = Group "offsetFetch" $ map (uncurry TestQueryExpr) > [-- ansi standard > ("select a from t offset 5 rows fetch next 10 rows only" > ,ms (Just $ NumLit "5") (Just $ NumLit "10")) @@ -123,6 +123,9 @@ These are a few misc tests which don't fit anywhere else. > ,ms Nothing (Just $ NumLit "10")) > ,("select a from t offset 5 row fetch first 10 row only" > ,ms (Just $ NumLit "5") (Just $ NumLit "10")) +> -- postgres +> ,("select a from t limit 10 offset 5" +> ,ms (Just $ NumLit "5") (Just $ NumLit "10")) > ] > where > ms o l = makeSelect diff --git a/tools/Language/SQL/SimpleSQL/Tpch.lhs b/tools/Language/SQL/SimpleSQL/Tpch.lhs index 0aefbdc..b069e7f 100644 --- a/tools/Language/SQL/SimpleSQL/Tpch.lhs +++ b/tools/Language/SQL/SimpleSQL/Tpch.lhs @@ -1,6 +1,10 @@ Some tests for parsing the tpch queries +The changes made to the official syntax are: +1. replace the set rowcount with ansi standard fetch first n rows only +2. replace the create view, query, drop view sequence with a query + using a common table expression > module Language.SQL.SimpleSQL.Tpch (tpchTests,tpchQueries) where @@ -79,7 +83,7 @@ Some tests for parsing the tpch queries > \ n_name,\n\ > \ s_name,\n\ > \ p_partkey\n\ -> \limit 100") +> \fetch first 100 rows only") > ,("Q3","\n\ > \ select\n\ > \ l_orderkey,\n\ @@ -103,7 +107,7 @@ Some tests for parsing the tpch queries > \ order by\n\ > \ revenue desc,\n\ > \ o_orderdate\n\ -> \ limit 10") +> \ fetch first 10 rows only") > ,("Q4","\n\ > \ select\n\ > \ o_orderpriority,\n\ @@ -304,7 +308,7 @@ Some tests for parsing the tpch queries > \ c_comment\n\ > \ order by\n\ > \ revenue desc\n\ -> \ limit 20") +> \ fetch first 20 rows only") > ,("Q11","\n\ > \ select\n\ > \ ps_partkey,\n\ @@ -522,7 +526,7 @@ Some tests for parsing the tpch queries > \ order by\n\ > \ o_totalprice desc,\n\ > \ o_orderdate\n\ -> \ limit 100") +> \ fetch first 100 rows only") > ,("Q19","\n\ > \ select\n\ > \ sum(l_extendedprice* (1 - l_discount)) as revenue\n\ @@ -637,7 +641,7 @@ Some tests for parsing the tpch queries > \ order by\n\ > \ numwait desc,\n\ > \ s_name\n\ -> \ limit 100") +> \ fetch first 100 rows only") > ,("Q22","\n\ > \ select\n\ > \ cntrycode,\n\