diff --git a/src/Access/SettingsConstraints.cpp b/src/Access/SettingsConstraints.cpp index 7dce4d96b33..958075541c8 100644 --- a/src/Access/SettingsConstraints.cpp +++ b/src/Access/SettingsConstraints.cpp @@ -157,23 +157,7 @@ bool SettingsConstraints::checkImpl(const Settings & current_settings, SettingCh const String & setting_name = change.name; if (setting_name == "profile") - { - /// TODO Check profile settings in Context::setProfile(...), not here. It will be backward incompatible. - const String & profile_name = change.value.safeGet(); - const auto & profile_settings_changes = manager->getProfileSettings(profile_name); - try - { - /// NOTE We cannot use CLAMP_ON_VIOLATION here, because we cannot modify elements of profile_settings_changes - for (auto change_copy : *profile_settings_changes) - checkImpl(current_settings, change_copy, THROW_ON_VIOLATION); - } - catch (Exception & e) - { - e.addMessage(", while trying to set settings profile {}", profile_name); - throw; - } return true; - } bool cannot_cast; auto cast_value = [&](const Field & x) -> Field diff --git a/src/Interpreters/Context.cpp b/src/Interpreters/Context.cpp index 482bfa83632..e3a837617ec 100644 --- a/src/Interpreters/Context.cpp +++ b/src/Interpreters/Context.cpp @@ -849,7 +849,17 @@ std::optional Context::getQuotaUsage() const void Context::setProfile(const String & profile_name) { - applySettingsChanges(*getAccessControlManager().getProfileSettings(profile_name)); + SettingsChanges profile_settings_changes = *getAccessControlManager().getProfileSettings(profile_name); + try + { + checkSettingsConstraints(profile_settings_changes); + } + catch (Exception & e) + { + e.addMessage(", while trying to set settings profile {}", profile_name); + throw; + } + applySettingsChanges(profile_settings_changes); }