Fix custom settings

This commit is contained in:
Michael Kolupaev 2024-12-03 11:09:08 +00:00
parent bc267d4427
commit 96a961583c
2 changed files with 8 additions and 1 deletions

View File

@ -841,7 +841,8 @@ void Connection::sendQuery(
modified_settings.emplace(*settings);
for (const SettingChange & change : settings_from_server)
{
if (settings->get(change.name) == change.value)
Field value;
if (settings->tryGet(change.name, value) && value == change.value)
{
// Mark as unchanged so it's not sent.
modified_settings->setDefaultValue(change.name);

View File

@ -339,7 +339,13 @@ void BaseSettings<TTraits>::resetToDefault(std::string_view name)
name = TTraits::resolveName(name);
const auto & accessor = Traits::Accessor::instance();
if (size_t index = accessor.find(name); index != static_cast<size_t>(-1))
{
accessor.resetValueToDefault(*this, index);
return;
}
if constexpr (Traits::allow_custom_settings)
custom_settings_map.erase(name);
}
template <typename TTraits>