mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 04:12:19 +00:00
fix 'Unknown setting profile' error
This commit is contained in:
parent
b1dc8074ef
commit
76e73e4e8b
@ -156,6 +156,25 @@ 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<String>();
|
||||
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
|
||||
{
|
||||
|
@ -0,0 +1,8 @@
|
||||
0 0
|
||||
0 0
|
||||
OK
|
||||
1 1
|
||||
2 1
|
||||
2 1
|
||||
OK
|
||||
1 1
|
15
tests/queries/0_stateless/01187_set_profile_as_setting.sh
Executable file
15
tests/queries/0_stateless/01187_set_profile_as_setting.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT -n -m -q "select value, changed from system.settings where name='readonly';"
|
||||
$CLICKHOUSE_CLIENT -n -m -q "set profile='default'; select value, changed from system.settings where name='readonly';"
|
||||
$CLICKHOUSE_CLIENT -n -m -q "set profile='readonly'; select value, changed from system.settings where name='readonly';" 2>&1| grep -Fa "Cannot modify 'send_logs_level' setting in readonly mode" > /dev/null && echo "OK"
|
||||
CLICKHOUSE_CLIENT=$(echo ${CLICKHOUSE_CLIENT} | sed 's/'"--send_logs_level=${CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL}"'/--send_logs_level=fatal/g')
|
||||
$CLICKHOUSE_CLIENT -n -m -q "set profile='readonly'; select value, changed from system.settings where name='readonly';"
|
||||
|
||||
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=select+value,changed+from+system.settings+where+name='readonly'"
|
||||
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&profile=default&query=select+value,changed+from+system.settings+where+name='readonly'"
|
||||
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&profile=readonly&query=select+value,changed+from+system.settings+where+name='readonly'" 2>&1| grep -Fa "Cannot modify 'readonly' setting in readonly mode" > /dev/null && echo "OK"
|
||||
echo "select value, changed from system.settings where name='readonly';" | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL}&profile=readonly" -d @-
|
Loading…
Reference in New Issue
Block a user