restrict parsing of * and X.* as term in expressions
This commit is contained in:
parent
6e1e377308
commit
742382fcc0
7 changed files with 127 additions and 135 deletions
tests/Language/SQL/SimpleSQL
|
@ -73,7 +73,22 @@ selectLists = Group "selectLists"
|
|||
[(BinOp (Iden [Name Nothing "a"]) [Name Nothing "+"]
|
||||
(BinOp (Iden [Name Nothing "b"]) [Name Nothing "*"] (Iden [Name Nothing "c"]))
|
||||
,Nothing)]}
|
||||
,q "select * from t"
|
||||
$ toQueryExpr $ makeSelect {msSelectList = [(Star,Nothing)]
|
||||
,msFrom = [TRSimple [Name Nothing "t"]]}
|
||||
|
||||
,q "select t.* from t"
|
||||
$ toQueryExpr $ makeSelect {msSelectList = [(QStar [Name Nothing "t"],Nothing)]
|
||||
,msFrom = [TRSimple [Name Nothing "t"]]}
|
||||
|
||||
,q "select t.*, a as b, u.* from t"
|
||||
$ toQueryExpr $ makeSelect
|
||||
{msSelectList =
|
||||
[(QStar [Name Nothing "t"],Nothing)
|
||||
,(Iden [Name Nothing "a"], Just $ Name Nothing "b")
|
||||
,(QStar [Name Nothing "u"],Nothing)]
|
||||
,msFrom = [TRSimple [Name Nothing "t"]]}
|
||||
|
||||
]
|
||||
|
||||
whereClause :: TestItem
|
||||
|
|
|
@ -3283,8 +3283,9 @@ querySpecification = Group "query specification"
|
|||
,("select distinct a from t",toQueryExpr $ ms {msSetQuantifier = Distinct})
|
||||
,("select * from t", toQueryExpr $ ms {msSelectList = [(Star,Nothing)]})
|
||||
,("select a.* from t"
|
||||
,toQueryExpr $ ms {msSelectList = [(BinOp (Iden [Name Nothing "a"]) [Name Nothing "."] Star
|
||||
,Nothing)]})
|
||||
,toQueryExpr $ ms {msSelectList =
|
||||
[(QStar [Name Nothing "a"]
|
||||
,Nothing)]})
|
||||
,("select a b from t"
|
||||
,toQueryExpr $ ms {msSelectList = [(Iden [Name Nothing "a"], Just $ Name Nothing "b")]})
|
||||
,("select a as b from t"
|
||||
|
|
|
@ -68,9 +68,8 @@ identifiers = Group "identifiers"
|
|||
|
||||
star :: TestItem
|
||||
star = Group "star"
|
||||
[t "*" Star
|
||||
--,("t.*", Star2 "t")
|
||||
--,("ROW(t.*,42)", App "ROW" [Star2 "t", NumLit "42"])
|
||||
[t "count(*)" $ App [Name Nothing "count"] [Star]
|
||||
,t "ROW(t.*,42)" $ App [Name Nothing "ROW"] [QStar [Name Nothing "t"], NumLit "42"]
|
||||
]
|
||||
|
||||
parameter :: TestItem
|
||||
|
@ -81,10 +80,8 @@ parameter = Group "parameter"
|
|||
dots :: TestItem
|
||||
dots = Group "dot"
|
||||
[t "t.a" $ Iden [Name Nothing "t",Name Nothing "a"]
|
||||
,t "t.*" $ BinOp (Iden [Name Nothing "t"]) [Name Nothing "."] Star
|
||||
,t "a.b.c" $ Iden [Name Nothing "a",Name Nothing "b",Name Nothing "c"]
|
||||
,t "ROW(t.*,42)"
|
||||
$ App [Name Nothing "ROW"] [BinOp (Iden [Name Nothing "t"]) [Name Nothing "."] Star, NumLit "42"]
|
||||
,t "ROW(t.*,42)" $ App [Name Nothing "ROW"] [QStar [Name Nothing "t"], NumLit "42"]
|
||||
]
|
||||
|
||||
app :: TestItem
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue