Skip to content

Commit efb08b5

Browse files
authored
Merge pull request #1 from timwmillard/altertypefix
Fixed ALTER TYPE to update column types
2 parents eec0fe1 + c38af20 commit efb08b5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/sql/catalog/types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,5 +207,16 @@ func (c *Catalog) renameType(stmt *ast.RenameTypeStmt) error {
207207

208208
}
209209

210+
// Update all the table column with the new type
211+
for si, schema := range c.Schemas {
212+
for ti, table := range schema.Tables {
213+
for ci, column := range table.Columns {
214+
if column.Type == *stmt.Type {
215+
c.Schemas[si].Tables[ti].Columns[ci].Type.Name = newName
216+
}
217+
}
218+
}
219+
}
220+
210221
return nil
211222
}

0 commit comments

Comments
 (0)