mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Checking updatable for user settings
This commit is contained in:
parent
7409f1a3de
commit
75c3ed967a
@ -1126,6 +1126,17 @@ void Context::applySettingsChanges(const SettingsChanges & changes)
|
||||
applySettingChange(change);
|
||||
}
|
||||
|
||||
void Context::updateSettingsChanges(const SettingsChanges & changes)
|
||||
{
|
||||
auto lock = getLock();
|
||||
for (const SettingChange & change : changes)
|
||||
{
|
||||
if (change.name == "profile")
|
||||
setProfile(change.value.safeGet<String>());
|
||||
else
|
||||
settings.updateFromChange(change);
|
||||
}
|
||||
}
|
||||
|
||||
void Context::checkSettingsConstraints(const SettingChange & change)
|
||||
{
|
||||
|
@ -281,6 +281,9 @@ public:
|
||||
void applySettingChange(const SettingChange & change);
|
||||
void applySettingsChanges(const SettingsChanges & changes);
|
||||
|
||||
/// Update checking that each setting is updatable
|
||||
void updateSettingsChanges(const SettingsChanges & changes);
|
||||
|
||||
/// Checks the constraints.
|
||||
void checkSettingsConstraints(const SettingChange & change);
|
||||
void checkSettingsConstraints(const SettingsChanges & changes);
|
||||
|
@ -10,7 +10,7 @@ BlockIO InterpreterSetQuery::execute()
|
||||
{
|
||||
const auto & ast = query_ptr->as<ASTSetQuery &>();
|
||||
context.checkSettingsConstraints(ast.changes);
|
||||
context.getSessionContext().applySettingsChanges(ast.changes);
|
||||
context.getSessionContext().updateSettingsChanges(ast.changes);
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ void InterpreterSetQuery::executeForCurrentContext()
|
||||
{
|
||||
const auto & ast = query_ptr->as<ASTSetQuery &>();
|
||||
context.checkSettingsConstraints(ast.changes);
|
||||
context.applySettingsChanges(ast.changes);
|
||||
context.updateSettingsChanges(ast.changes);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user