code: func checkPriKeyConstraint(col *table.Column, hasDefaultValue, hasNullFlag bool, outPriKeyConstraint *ast.Constraint) error {
  	// Primary key should not be null.
  	if mysql.HasPriKeyFlag(col.Flag) && hasDefaultValue && col.GetDefaultValue() == nil {
  		return types.ErrInvalidDefault.GenWithStackByArgs(col.Name)
  	}
  	// Set primary key flag for outer primary key constraint.
  	// Such as: create table t1 (id int , age int, primary key(id))
  	if !mysql.HasPriKeyFlag(col.Flag) && outPriKeyConstraint != nil {
  		for _, key := range outPriKeyConstraint.Keys {
  			if key.Column.Name.L != col.Name.L {
  				continue
  			}
  			col.Flag |= mysql.PriKeyFlag
  			break
  		}
  	}
  	// Primary key should not be null.
  	if mysql.HasPriKeyFlag(col.Flag) && hasNullFlag {
  		return ErrPrimaryCantHaveNull
  	}
  	return nil
  }
docs: // checkPriKeyConstraint check all parts of a PRIMARY KEY must be NOT NULL