(table *Table, cmd *ast.AlterTableCmd)
| 42 | } |
| 43 | |
| 44 | func (c *Catalog) addColumn(table *Table, cmd *ast.AlterTableCmd) error { |
| 45 | for _, c := range table.Columns { |
| 46 | if c.Name == cmd.Def.Colname { |
| 47 | if !cmd.MissingOk { |
| 48 | return sqlerr.ColumnExists(table.Rel.Name, cmd.Def.Colname) |
| 49 | } |
| 50 | return nil |
| 51 | } |
| 52 | } |
| 53 | tc, err := c.defineColumn(table.Rel, cmd.Def) |
| 54 | if err != nil { |
| 55 | return err |
| 56 | } |
| 57 | table.Columns = append(table.Columns, tc) |
| 58 | return nil |
| 59 | } |
| 60 | |
| 61 | func (table *Table) alterColumnType(cmd *ast.AlterTableCmd) error { |
| 62 | index, err := table.isExistColumn(cmd) |
no test coverage detected