@@ -571,6 +571,13 @@ func (p *provider) revokeTableRolesFromMember(ctx context.Context, pc *domain.Pr
571571 roleQuery := strings .Join (slices .GenericsStandardizeSlice (roles ), ", " )
572572 var query = fmt .Sprintf ("REVOKE %s ON TABLE `%s`.`%s`.`%s` FROM USER `%s`" , roleQuery , project , schema , table , ramAccountId )
573573 if _ , err = odpsExecuteQueryOnSecurityManager (ctx , invoker , query ); err != nil {
574+ // If the table no longer exists in MaxCompute there is nothing left to revoke,
575+ // so treat it as a successful no-op. Otherwise a dropped table would permanently
576+ // block stale-grant cleanup (e.g. auto-access-restoration). This mirrors the
577+ // NoSuchObject handling in revokeProjectRolesFromMember.
578+ if isTableNotFoundErr (err ) {
579+ return nil
580+ }
574581 var restErr restclient.HttpError
575582 if errors .As (err , & restErr ) && restErr .ErrorMessage != nil {
576583 return fmt .Errorf ("fail to revoke table role from '%s.%s.%s': %s" , project , schema , table , restErr .ErrorMessage .Message )
@@ -580,6 +587,16 @@ func (p *provider) revokeTableRolesFromMember(ctx context.Context, pc *domain.Pr
580587 return nil
581588}
582589
590+ // isTableNotFoundErr reports whether err is a MaxCompute "table not found" error
591+ // (ODPS-0130131). When revoking a role on a table that has already been dropped,
592+ // the grant is effectively gone, so callers can treat this as a no-op.
593+ func isTableNotFoundErr (err error ) bool {
594+ if err == nil {
595+ return false
596+ }
597+ return strings .Contains (err .Error (), "ODPS-0130131" )
598+ }
599+
583600// ---------------------------------------------------------------------------------------------------------------------
584601// External Client
585602// ---------------------------------------------------------------------------------------------------------------------
0 commit comments