diff --git a/pkg/sql/drop_role.go b/pkg/sql/drop_role.go index 6271900d2a95..0ebb513152ea 100644 --- a/pkg/sql/drop_role.go +++ b/pkg/sql/drop_role.go @@ -16,6 +16,7 @@ import ( "sort" "strings" + "github.com/cockroachdb/cockroach/pkg/clusterversion" "github.com/cockroachdb/cockroach/pkg/security/username" "github.com/cockroachdb/cockroach/pkg/sql/catalog" "github.com/cockroachdb/cockroach/pkg/sql/catalog/catpb" @@ -586,6 +587,9 @@ func addDependentPrivilegesFromSystemPrivileges( privilegeObjectFormatter *tree.FmtCtx, userNamesToDependentPrivileges map[username.SQLUsername][]objectAndType, ) (retErr error) { + if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.V22_2SystemPrivilegesTable) { + return nil + } names := make([]string, len(usernames)) for i, username := range usernames { names[i] = username.Normalized()