mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-22 02:51:21 -05:00
enough to stop panics
This commit is contained in:
@@ -1492,7 +1492,11 @@ func validateSchemaChange(
|
||||
idxCols []sql.IndexColumn,
|
||||
) error {
|
||||
for _, idxCol := range idxCols {
|
||||
col := newSchema.Schema[newSchema.Schema.IndexOfColName(idxCol.Name)]
|
||||
idx := newSchema.Schema.IndexOfColName(idxCol.Name)
|
||||
if idx < 0 { // avoid panics
|
||||
return sql.ErrColumnNotFound.New(idxCol.Name)
|
||||
}
|
||||
col := newSchema.Schema[idx]
|
||||
if col.PrimaryKey && idxCol.Length > 0 && sqltypes.IsText(col.Type) {
|
||||
return sql.ErrUnsupportedIndexPrefix.New(col.Name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user