@@ -159,7 +159,7 @@ func resolveAlterColumn(ctx *sql.Context, a *Analyzer, n sql.Node, scope *Scope,
159159 if err != nil {
160160 return nil , transform .SameTree , err
161161 }
162- sch , err = validatePrimaryKey (initialSch , sch , n .(* plan.AlterPK ))
162+ sch , err = validatePrimaryKey (ctx , initialSch , sch , n .(* plan.AlterPK ))
163163 if err != nil {
164164 return nil , transform .SameTree , err
165165 }
@@ -610,7 +610,7 @@ func validateIndexes(ctx *sql.Context, tableSpec *plan.TableSpec) error {
610610 if ! ok {
611611 return sql .ErrUnknownIndexColumn .New (idxCol .Name , idx .IndexName )
612612 }
613- err := validatePrefixLength (schCol , idxCol )
613+ err := validatePrefixLength (ctx , schCol , idxCol )
614614 if err != nil {
615615 return err
616616 }
@@ -683,7 +683,7 @@ func getTableIndexNames(ctx *sql.Context, a *Analyzer, table sql.Node) ([]string
683683}
684684
685685// validatePrimaryKey validates a primary key add or drop operation.
686- func validatePrimaryKey (initialSch , sch sql.Schema , ai * plan.AlterPK ) (sql.Schema , error ) {
686+ func validatePrimaryKey (ctx * sql. Context , initialSch , sch sql.Schema , ai * plan.AlterPK ) (sql.Schema , error ) {
687687 tableName := getTableName (ai .Table )
688688 switch ai .Action {
689689 case plan .PrimaryKeyAction_Create :
@@ -698,7 +698,7 @@ func validatePrimaryKey(initialSch, sch sql.Schema, ai *plan.AlterPK) (sql.Schem
698698
699699 for _ , idxCol := range ai .Columns {
700700 schCol := sch [sch .IndexOf (idxCol .Name , tableName )]
701- err := validatePrefixLength (schCol , idxCol )
701+ err := validatePrefixLength (ctx , schCol , idxCol )
702702 if err != nil {
703703 return nil , err
704704 }
0 commit comments