Skip to content

Commit 956c37d

Browse files
authored
[no-release-notes] tighten up enum behavior (#2755)
* [no-release-notes] tighten up enum behavior * delete comment
1 parent efb1484 commit 956c37d

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
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: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -470,15 +470,6 @@ 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-
}
481-
482473
// TODO: When a column is being modified, we should ideally check that any existing table check constraints
483474
// are still valid (e.g. if the column type changed) and throw an error if they are invalidated.
484475
// That would be consistent with MySQL behavior.

0 commit comments

Comments
 (0)