This commit is contained in:
kssenii 2021-12-28 15:08:40 +03:00
parent 61a2516c8c
commit e9b4439a47
2 changed files with 6 additions and 5 deletions

View File

@ -172,8 +172,9 @@ static void validateConfigKeys(
dict_config.keys(config_prefix, config_keys);
for (const auto & config_key : config_keys)
{
if (!allowed_keys.contains(config_key))
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unexpected key `{}` in dictionary source configuration", config_key);
if (allowed_keys.contains(config_key) || config_key.starts_with("replica"))
continue;
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unexpected key `{}` in dictionary source configuration", config_key);
}
}
@ -205,7 +206,7 @@ std::optional<ExternalDataSourceConfiguration> getExternalDataSourceConfiguratio
if (configuration.host.empty() || configuration.port == 0 || configuration.username.empty() || configuration.table.empty())
{
throw Exception(ErrorCodes::BAD_ARGUMENTS,
"Named collection of connection parameters is missing some of the parameters and dictionary parameters are added");
"Named collection of connection parameters is missing some of the parameters and dictionary parameters are not added");
}
return configuration;
}

View File

@ -388,8 +388,8 @@ def test_bad_configuration(started_cluster):
LAYOUT(HASHED());
''')
result = node1.query_and_get_error("SELECT dictGetUInt32(postgres_dict, 'value', toUInt64(1))")
assert 'Unexpected key in config: dbbb' in result
node1.query_and_get_error("SELECT dictGetUInt32(postgres_dict, 'value', toUInt64(1))")
assert node1.contains_in_log('Unexpected key `dbbb`')
if __name__ == '__main__':