Parse constraints not separated by comma
This commit is contained in:
parent
d8b32c0931
commit
51157d502e
3 changed files with 34 additions and 6 deletions
Language/SQL/SimpleSQL
|
@ -1509,12 +1509,17 @@ TODO: change style
|
|||
> CreateSchema <$> names
|
||||
|
||||
> createTable :: Parser Statement
|
||||
> createTable = keyword_ "table" >>
|
||||
> createTable = do
|
||||
> let
|
||||
> parseColumnDef = TableColumnDef <$> columnDef
|
||||
> parseConstraintDef = uncurry TableConstraintDef <$> tableConstraintDef
|
||||
> constraints = sepBy parseConstraintDef (optional comma)
|
||||
> entries = ((:) <$> parseColumnDef <*> ((comma >> entries) <|> pure [])) <|> constraints
|
||||
>
|
||||
> keyword_ "table" >>
|
||||
> CreateTable
|
||||
> <$> names
|
||||
> -- todo: is this order mandatory or is it a perm?
|
||||
> <*> parens (commaSep1 (uncurry TableConstraintDef <$> tableConstraintDef
|
||||
> <|> TableColumnDef <$> columnDef))
|
||||
> <$> names
|
||||
> <*> parens entries
|
||||
|
||||
> createIndex :: Parser Statement
|
||||
> createIndex =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue