func NewCreateTable(db sql.Database, name string, ifn IfNotExistsOption, temp TempTableOption, tableSpec *TableSpec) *CreateTable {
	for _, s := range tableSpec.Schema {
		s.Source = name
	}
	return &CreateTable{
		ddlNode:     ddlNode{db},
		name:        name,
		schema:      tableSpec.Schema,
		fkDefs:      tableSpec.FkDefs,
		chDefs:      tableSpec.ChDefs,
		idxDefs:     tableSpec.IdxDefs,
		ifNotExists: ifn,
		temporary:   temp,
	}
}
NewCreateTable creates a new CreateTable node
package plan
import (
	"fmt"
	"strings"
	"gopkg.in/src-d/go-errors.v1"
	"github.com/dolthub/go-mysql-server/sql"
	"github.com/dolthub/go-mysql-server/sql/expression"
)
var ErrCreateTableNotSupported = errors.NewKind("tables cannot be created on database %s")
var ErrDropTableNotSupported = errors.NewKind("tables cannot be dropped on database %s")
var ErrRenameTableNotSupported = errors.NewKind("tables cannot be renamed on database %s")
var ErrAlterTableNotSupported = errors.NewKind("table %s cannot be altered on database %s")
var ErrNullDefault = errors.NewKind("column declared not null must have a non-null default value")
var ErrTableCreatedNotFound = errors.NewKind("table was created but could not be found")
type IfNotExistsOption bool
const (
	IfNotExists       IfNotExistsOption = true
	IfNotExistsAbsent IfNotExistsOption = false
)
type TempTableOption bool
const (
	IsTempTable       TempTableOption = true
	IsTempTableAbsent TempTableOption = false
)
type ddlNode struct {
	db sql.Database
}
func (c *ddlNode) Resolved() bool {
	_, ok := c.db.(sql.UnresolvedDatabase)
	return !ok
}
func (c *ddlNode) Database() sql.Database {
	return c.db
}
func (*ddlNode) Schema() sql.Schema { return nil }
func (c *ddlNode) Children() []sql.Node { return nil }
type IndexDefinition struct {
	IndexName  string
	Using      sql.IndexUsing
	Constraint sql.IndexConstraint
	Columns    []sql.IndexColumn
	Comment    string
}
func (i *IndexDefinition) String() string {
	return i.IndexName
}
type TableSpec struct {
	Schema  sql.Schema
	FkDefs  []*sql.ForeignKeyConstraint
	ChDefs  []*sql.CheckConstraint
	IdxDefs []*IndexDefinition
}
func (c *TableSpec) WithSchema(schema sql.Schema) *TableSpec {
	nc := *c
	nc.Schema = schema
	return &nc
}
func (c *TableSpec) WithForeignKeys(fkDefs []*sql.ForeignKeyConstraint) *TableSpec {
	nc := *c
	nc.FkDefs = fkDefs
	return &nc
}
func (c *TableSpec) WithCheckConstraints(chDefs []*sql.CheckConstraint) *TableSpec {
	nc := *c
	nc.ChDefs = chDefs
	return &nc
}
func (c *TableSpec) WithIndices(idxDefs []*IndexDefinition) *TableSpec {
	nc := *c
	nc.IdxDefs = idxDefs
	return &nc
}
type CreateTable struct {
	ddlNode
	name        string
	schema      sql.Schema
	ifNotExists IfNotExistsOption
	fkDefs      []*sql.ForeignKeyConstraint
	chDefs      []*sql.CheckConstraint
	idxDefs     []*IndexDefinition
	like        sql.Node
	temporary   TempTableOption
	selectNode  sql.Node
}
var _ sql.Databaser = (*CreateTable)(nil)
var _ sql.Node = (*CreateTable)(nil)
var _ sql.Expressioner = (*CreateTable)(nil)