MCPcopy
hub / github.com/pingcap/tidb / checkModifyColumnWithGeneratedColumnsConstraint

Function checkModifyColumnWithGeneratedColumnsConstraint

pkg/ddl/modify_column.go:1385–1401  ·  view source on GitHub ↗
(allCols []*table.Column, oldColName pmodel.CIStr)

Source from the content-addressed store, hash-verified

1383}
1384
1385func checkModifyColumnWithGeneratedColumnsConstraint(allCols []*table.Column, oldColName pmodel.CIStr) error {
1386 for _, col := range allCols {
1387 if col.GeneratedExpr == nil {
1388 continue
1389 }
1390 dependedColNames := FindColumnNamesInExpr(col.GeneratedExpr.Internal())
1391 for _, name := range dependedColNames {
1392 if name.Name.L == oldColName.L {
1393 if col.Hidden {
1394 return dbterror.ErrDependentByFunctionalIndex.GenWithStackByArgs(oldColName.O)
1395 }
1396 return dbterror.ErrDependentByGeneratedColumn.GenWithStackByArgs(oldColName.O)
1397 }
1398 }
1399 }
1400 return nil
1401}
1402
1403var colStateOrd = map[model.SchemaState]int{
1404 model.StateNone: 0,

Callers 2

RenameColumnMethod · 0.85
GetModifiableColumnJobFunction · 0.85

Calls 2

FindColumnNamesInExprFunction · 0.85
InternalMethod · 0.80

Tested by

no test coverage detected