get star parsing working everywhere
This commit is contained in:
parent
abc30b82e6
commit
9461a11c97
|
@ -126,7 +126,8 @@ of dots.
|
||||||
|
|
||||||
== star
|
== star
|
||||||
|
|
||||||
used in select *, select x.*, and agg(*) variations.
|
used in select *, select x.*, and agg(*) variations, and some other
|
||||||
|
places as well.
|
||||||
|
|
||||||
> star :: P ScalarExpr
|
> star :: P ScalarExpr
|
||||||
> star = choice [Star <$ symbol "*"
|
> star = choice [Star <$ symbol "*"
|
||||||
|
@ -147,8 +148,7 @@ aggregate([all|distinct] args [order by orderitems])
|
||||||
> makeApp
|
> makeApp
|
||||||
> <$> identifierString
|
> <$> identifierString
|
||||||
> <*> parens ((,,) <$> try duplicates
|
> <*> parens ((,,) <$> try duplicates
|
||||||
> <*> choice [(:[]) <$> try star
|
> <*> choice [commaSep scalarExpr']
|
||||||
> ,commaSep scalarExpr']
|
|
||||||
> <*> try (optionMaybe orderBy))
|
> <*> try (optionMaybe orderBy))
|
||||||
> where
|
> where
|
||||||
> makeApp i (Nothing,es,Nothing) = App i es
|
> makeApp i (Nothing,es,Nothing) = App i es
|
||||||
|
@ -445,6 +445,7 @@ could at least do with some heavy explanation.
|
||||||
> ,prefixUnaryOp
|
> ,prefixUnaryOp
|
||||||
> ,try app
|
> ,try app
|
||||||
> ,try dottedIden
|
> ,try dottedIden
|
||||||
|
> ,try star
|
||||||
> ,identifier
|
> ,identifier
|
||||||
> ,sparens]
|
> ,sparens]
|
||||||
|
|
||||||
|
@ -474,9 +475,7 @@ easy to ensure that this fix is only applied once to each scalar
|
||||||
expression tree (for efficiency and code clarity).
|
expression tree (for efficiency and code clarity).
|
||||||
|
|
||||||
> scalarExpr :: P ScalarExpr
|
> scalarExpr :: P ScalarExpr
|
||||||
> scalarExpr =
|
> scalarExpr = fixFixities sqlFixities <$> scalarExpr'
|
||||||
> choice [try star
|
|
||||||
> ,fixFixities sqlFixities <$> scalarExpr']
|
|
||||||
|
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ TODO: get all the commented out tests working
|
||||||
> \ FROM states;"
|
> \ FROM states;"
|
||||||
> ,"SELECT ROW(1,2.5,'this is a test');"
|
> ,"SELECT ROW(1,2.5,'this is a test');"
|
||||||
|
|
||||||
> --,"SELECT ROW(t.*, 42) FROM t;" -- needs the .* parsing to be enabled in more contexts
|
> ,"SELECT ROW(t.*, 42) FROM t;"
|
||||||
> ,"SELECT ROW(t.f1, t.f2, 42) FROM t;"
|
> ,"SELECT ROW(t.f1, t.f2, 42) FROM t;"
|
||||||
> ,"SELECT getf1(CAST(ROW(11,'this is a test',2.5) AS myrowtype));"
|
> ,"SELECT getf1(CAST(ROW(11,'this is a test',2.5) AS myrowtype));"
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ Tests for parsing scalar expressions
|
||||||
> star = Group "star" $ map (uncurry TestScalarExpr)
|
> star = Group "star" $ map (uncurry TestScalarExpr)
|
||||||
> [("*", Star)
|
> [("*", Star)
|
||||||
> ,("t.*", Star2 "t")
|
> ,("t.*", Star2 "t")
|
||||||
|
> ,("ROW(t.*,42)", App "ROW" [Star2 "t", NumLit "42"])
|
||||||
> ]
|
> ]
|
||||||
|
|
||||||
> app :: TestItem
|
> app :: TestItem
|
||||||
|
|
Loading…
Reference in a new issue