Skip to content

Commit 3b1b214

Browse files
committed
[no-release-notes] tighten up enum behavior
1 parent efb1484 commit 3b1b214

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

enginetest/queries/script_queries.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ var ScriptTests = []ScriptTest{
132132
},
133133
{
134134
Query: "alter table xy modify y enum('a')",
135-
ExpectedErr: sql.ErrEnumTypeTruncated,
135+
ExpectedErr: types.ErrConvertingToEnum,
136136
},
137137
},
138138
},
@@ -7511,7 +7511,7 @@ where
75117511
},
75127512
{
75137513
Query: "alter table t modify column e enum('abc');",
7514-
ExpectedErr: sql.ErrEnumTypeTruncated,
7514+
ExpectedErr: types.ErrConvertingToEnum,
75157515
},
75167516
},
75177517
},

sql/analyzer/validate_create_table.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,14 @@ func validateModifyColumn(ctx *sql.Context, initialSch sql.Schema, schema sql.Sc
470470
return nil, err
471471
}
472472

473-
if e1, ok := newCol.Type.(sql.EnumType); ok {
474-
oldCol := initialSch[initialSch.IndexOfColName(oldColName)]
475-
if e2, ok := oldCol.Type.(sql.EnumType); ok {
476-
if len(e1.Values()) < len(e2.Values()) {
477-
return nil, sql.ErrEnumTypeTruncated.New()
478-
}
479-
}
480-
}
473+
//if e1, ok := newCol.Type.(sql.EnumType); ok {
474+
// oldCol := initialSch[initialSch.IndexOfColName(oldColName)]
475+
// if e2, ok := oldCol.Type.(sql.EnumType); ok {
476+
// if len(e1.Values()) < len(e2.Values()) {
477+
// return nil, sql.ErrEnumTypeTruncated.New()
478+
// }
479+
// }
480+
//}
481481

482482
// TODO: When a column is being modified, we should ideally check that any existing table check constraints
483483
// are still valid (e.g. if the column type changed) and throw an error if they are invalidated.

0 commit comments

Comments
 (0)