code: func composeTablePrivUpdateForGrant(ctx sessionctx.Context, priv mysql.PrivilegeType, name string, host string, db string, tbl string) (string, error) {
  	var newTablePriv, newColumnPriv string
  	if priv == mysql.AllPriv {
  		for _, p := range mysql.AllTablePrivs {
  			v, ok := mysql.Priv2SetStr[p]
  			if !ok {
  				return "", errors.Errorf("Unknown table privilege %v", p)
  			}
  			newTablePriv = addToSet(newTablePriv, v)
  		}
  		for _, p := range mysql.AllColumnPrivs {
  			v, ok := mysql.Priv2SetStr[p]
  			if !ok {
  				return "", errors.Errorf("Unknown column privilege %v", p)
  			}
  			newColumnPriv = addToSet(newColumnPriv, v)
  		}
  	} else {
  		currTablePriv, currColumnPriv, err := getTablePriv(ctx, name, host, db, tbl)
  		if err != nil {
  			return "", err
  		}
  		p, ok := mysql.Priv2SetStr[priv]
  		if !ok {
  			return "", errors.Errorf("Unknown priv: %v", priv)
  		}
  		newTablePriv = addToSet(currTablePriv, p)
  
  		for _, cp := range mysql.AllColumnPrivs {
  			if priv == cp {
  				newColumnPriv = addToSet(currColumnPriv, p)
  				break
  			}
  		}
  	}
  	return fmt.Sprintf(`Table_priv='%s', Column_priv='%s', Grantor='%s'`, newTablePriv, newColumnPriv, ctx.GetSessionVars().User), nil
  }
docs: // composeTablePrivUpdateForGrant composes update stmt assignment list for table scope privilege update.