2021-06-27 19:09:17 +00:00
|
|
|
#include "MaterializedPostgreSQLSettings.h"
|
2021-02-18 06:06:37 +00:00
|
|
|
|
|
|
|
#if USE_LIBPQXX
|
2021-01-01 14:43:11 +00:00
|
|
|
#include <Parsers/ASTCreateQuery.h>
|
|
|
|
#include <Parsers/ASTSetQuery.h>
|
|
|
|
#include <Parsers/ASTFunction.h>
|
|
|
|
#include <Common/Exception.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int UNKNOWN_SETTING;
|
|
|
|
}
|
|
|
|
|
2021-06-27 19:09:17 +00:00
|
|
|
IMPLEMENT_SETTINGS_TRAITS(MaterializedPostgreSQLSettingsTraits, LIST_OF_MATERIALIZED_POSTGRESQL_SETTINGS)
|
2021-01-01 14:43:11 +00:00
|
|
|
|
2021-06-27 19:09:17 +00:00
|
|
|
void MaterializedPostgreSQLSettings::loadFromQuery(ASTStorage & storage_def)
|
2021-01-01 14:43:11 +00:00
|
|
|
{
|
|
|
|
if (storage_def.settings)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
applyChanges(storage_def.settings->changes);
|
|
|
|
}
|
|
|
|
catch (Exception & e)
|
|
|
|
{
|
|
|
|
if (e.code() == ErrorCodes::UNKNOWN_SETTING)
|
|
|
|
e.addMessage("for storage " + storage_def.engine->name);
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
auto settings_ast = std::make_shared<ASTSetQuery>();
|
|
|
|
settings_ast->is_standalone = false;
|
|
|
|
storage_def.set(storage_def.settings, settings_ast);
|
|
|
|
}
|
|
|
|
}
|
2021-02-18 06:06:37 +00:00
|
|
|
|
2021-01-01 14:43:11 +00:00
|
|
|
}
|
2021-02-18 06:06:37 +00:00
|
|
|
|
|
|
|
#endif
|