From c38af20e243ae2112aa13e5ab52a219867c79a06 Mon Sep 17 00:00:00 2001 From: Tim Millard Date: Fri, 9 Apr 2021 20:23:29 +1000 Subject: [PATCH] fixed alter type to update column types --- internal/sql/catalog/types.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/sql/catalog/types.go b/internal/sql/catalog/types.go index 409bbd7447..baf0e41e95 100644 --- a/internal/sql/catalog/types.go +++ b/internal/sql/catalog/types.go @@ -207,5 +207,16 @@ func (c *Catalog) renameType(stmt *ast.RenameTypeStmt) error { } + // Update all the table column with the new type + for si, schema := range c.Schemas { + for ti, table := range schema.Tables { + for ci, column := range table.Columns { + if column.Type == *stmt.Type { + c.Schemas[si].Tables[ti].Columns[ci].Type.Name = newName + } + } + } + } + return nil }