diff --git a/src/Databases/DatabaseFactory.cpp b/src/Databases/DatabaseFactory.cpp index 82a7dff7125..5c7c1dedf9b 100644 --- a/src/Databases/DatabaseFactory.cpp +++ b/src/Databases/DatabaseFactory.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "config_core.h" @@ -334,18 +335,25 @@ DatabasePtr DatabaseFactory::getImpl(const ASTCreateQuery & create, const String configuration.username = safeGetLiteralValue(engine_args[2], engine_name); configuration.password = safeGetLiteralValue(engine_args[3], engine_name); + bool is_deprecated_syntax = false; if (engine_args.size() >= 5) { auto arg_value = engine_args[4]->as()->value; if (arg_value.getType() == Field::Types::Which::String) + { configuration.schema = safeGetLiteralValue(engine_args[4], engine_name); + } else + { use_table_cache = safeGetLiteralValue(engine_args[4], engine_name); + LOG_WARNING(&Poco::Logger::get("DatabaseFactory"), "A deprecated syntax of PostgreSQL database engine is used"); + is_deprecated_syntax = true; + } } - } - if (engine_args.size() >= 6) - use_table_cache = safeGetLiteralValue(engine_args[5], engine_name); + if (!is_deprecated_syntax && engine_args.size() >= 6) + use_table_cache = safeGetLiteralValue(engine_args[5], engine_name); + } auto pool = std::make_shared(configuration, context->getSettingsRef().postgresql_connection_pool_size,