1
Fork 0

partial support for lateral

This commit is contained in:
Jake Wheat 2013-12-17 12:45:32 +02:00
parent d49b3ddb99
commit 939189a04f
5 changed files with 36 additions and 8 deletions
Language/SQL/SimpleSQL

View file

@ -505,6 +505,7 @@ tref
> tref = nonJoinTref >>= optionSuffix joinTrefSuffix
> nonJoinTref = choice [try (TRQueryExpr <$> parens queryExpr)
> ,TRParens <$> parens tref
> ,TRLateral <$> (try (keyword_ "lateral") *> tref)
> ,try (TRFunction <$> identifierString
> <*> parens (commaSep scalarExpr))
> ,TRSimple <$> identifierString]
@ -690,7 +691,7 @@ keyword parser also
> ["select", "as", "from", "where", "having", "group", "order"
> ,"limit", "offset"
> ,"inner", "left", "right", "full", "natural", "join"
> ,"cross", "on", "using"
> ,"cross", "on", "using", "lateral"
> ,"when", "then", "case", "end", "in"
> ,"except", "intersect", "union"]

View file

@ -182,6 +182,7 @@
> ,nest 5 $ vcat $ punctuate comma $ map tr ts]
> where
> tr (TRSimple t) = text t
> tr (TRLateral t) = text "lateral" <+> tr t
> tr (TRFunction f as) =
> text f <> parens (commaSep $ map scalarExpr as)
> tr (TRAlias t a cs) =

View file

@ -197,6 +197,8 @@ I'm not sure if this is valid syntax or not.
> | TRQueryExpr QueryExpr
> -- | from function(args)
> | TRFunction String [ScalarExpr]
> -- | from lateral t
> | TRLateral TableRef
> deriving (Eq,Show,Read)
TODO: add function table ref