Added basic CREATE INDEX
parsing
This commit is contained in:
parent
bfa1b40b21
commit
54cefdc2ee
|
@ -1460,6 +1460,7 @@ TODO: change style
|
|||
> statement = choice
|
||||
> [keyword_ "create" *> choice [createSchema
|
||||
> ,createTable
|
||||
> ,createIndex
|
||||
> ,createView
|
||||
> ,createDomain
|
||||
> ,createSequence
|
||||
|
@ -1501,6 +1502,15 @@ TODO: change style
|
|||
> <*> parens (commaSep1 (uncurry TableConstraintDef <$> tableConstraintDef
|
||||
> <|> TableColumnDef <$> columnDef))
|
||||
|
||||
> createIndex :: Parser Statement
|
||||
> createIndex =
|
||||
> CreateIndex
|
||||
> <$> ((keyword_ "index" >> pure False) <|>
|
||||
> (keywords_ ["unique", "index"] >> pure True))
|
||||
> <*> names
|
||||
> <*> (keyword_ "on" >> name)
|
||||
> <*> parens (commaSep1 name)
|
||||
|
||||
> columnDef :: Parser ColumnDef
|
||||
> columnDef = ColumnDef <$> name <*> typeName
|
||||
> <*> optionMaybe defaultClause
|
||||
|
|
|
@ -454,6 +454,7 @@ I'm not sure if this is valid syntax or not.
|
|||
> | CreateTable [Name] [TableElement]
|
||||
> | AlterTable [Name] AlterTableAction
|
||||
> | DropTable [Name] DropBehaviour
|
||||
> | CreateIndex Bool [Name] Name [Name]
|
||||
> | CreateView Bool [Name] (Maybe [Name])
|
||||
> QueryExpr (Maybe CheckOption)
|
||||
> | DropView [Name] DropBehaviour
|
||||
|
|
Loading…
Reference in a new issue