fix extra 'as' when printing ctes
This commit is contained in:
parent
ce0eeb392a
commit
9f4a457a4d
|
@ -1482,8 +1482,11 @@ allows offset and fetch in either order
|
||||||
> With <$> option False (True <$ keyword_ "recursive")
|
> With <$> option False (True <$ keyword_ "recursive")
|
||||||
> <*> commaSep1 withQuery <*> queryExpr
|
> <*> commaSep1 withQuery <*> queryExpr
|
||||||
> where
|
> where
|
||||||
> withQuery = (,) <$> (fromAlias <* keyword_ "as")
|
> withQuery = (,) <$> (withAlias <* keyword_ "as")
|
||||||
> <*> parens queryExpr
|
> <*> parens queryExpr
|
||||||
|
> withAlias = Alias <$> name <*> columnAliases
|
||||||
|
> columnAliases = optionMaybe $ parens $ commaSep1 name
|
||||||
|
|
||||||
|
|
||||||
== query expression
|
== query expression
|
||||||
|
|
||||||
|
|
|
@ -360,8 +360,13 @@ which have been changed to try to improve the layout of the output.
|
||||||
> text "with" <+> (if rc then text "recursive" else empty)
|
> text "with" <+> (if rc then text "recursive" else empty)
|
||||||
> <+> vcat [nest 5
|
> <+> vcat [nest 5
|
||||||
> (vcat $ punctuate comma $ flip map withs $ \(n,q) ->
|
> (vcat $ punctuate comma $ flip map withs $ \(n,q) ->
|
||||||
> alias n <+> text "as" <+> parens (queryExpr d q))
|
> withAlias n <+> text "as" <+> parens (queryExpr d q))
|
||||||
> ,queryExpr d qe]
|
> ,queryExpr d qe]
|
||||||
|
> where
|
||||||
|
> withAlias (Alias nm cols) = name nm
|
||||||
|
> <+> me (parens . commaSep . map name) cols
|
||||||
|
|
||||||
|
|
||||||
> queryExpr d (Values vs) =
|
> queryExpr d (Values vs) =
|
||||||
> text "values"
|
> text "values"
|
||||||
> <+> nest 7 (commaSep (map (parens . commaSep . map (scalarExpr d)) vs))
|
> <+> nest 7 (commaSep (map (parens . commaSep . map (scalarExpr d)) vs))
|
||||||
|
|
Loading…
Reference in a new issue