#include #include #include #include #include #include namespace DB { NamesAndTypesList StorageSystemSettings::getNamesAndTypes() { return { {"name", std::make_shared()}, {"value", std::make_shared()}, {"changed", std::make_shared()}, {"description", std::make_shared()}, {"min", std::make_shared(std::make_shared())}, {"max", std::make_shared(std::make_shared())}, {"readonly", std::make_shared()}, {"type", std::make_shared()}, }; } #ifndef __clang__ #pragma GCC optimize("-fno-var-tracking-assignments") #endif void StorageSystemSettings::fillData(MutableColumns & res_columns, const Context & context, const SelectQueryInfo &) const { const Settings & settings = context.getSettingsRef(); auto settings_constraints = context.getSettingsConstraints(); for (const auto & setting : settings) { StringRef setting_name = setting.getName(); res_columns[0]->insert(setting_name.toString()); res_columns[1]->insert(setting.getValueAsString()); res_columns[2]->insert(setting.isChanged()); res_columns[3]->insert(setting.getDescription().toString()); Field min, max; bool read_only = false; if (settings_constraints) settings_constraints->get(setting_name, min, max, read_only); /// These two columns can accept strings only. if (!min.isNull()) min = Settings::valueToString(setting_name, min); if (!max.isNull()) max = Settings::valueToString(setting_name, max); if (!read_only) { if ((settings.readonly == 1) || ((settings.readonly > 1) && (setting_name == "readonly")) || ((!settings.allow_ddl) && (setting_name == "allow_ddl"))) read_only = true; } res_columns[4]->insert(min); res_columns[5]->insert(max); res_columns[6]->insert(read_only); res_columns[7]->insert(setting.getType().toString()); } } }