From 835c8a317e7855b2eb0f612cf1daa92d2d33eba1 Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Wed, 4 Feb 2015 19:10:27 +0300 Subject: [PATCH] dbms: prohibit local clickhouse as a dictionary source [#METR-13298] --- .../DB/Dictionaries/ClickhouseDictionarySource.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dbms/include/DB/Dictionaries/ClickhouseDictionarySource.h b/dbms/include/DB/Dictionaries/ClickhouseDictionarySource.h index a74092ef20b..48c05e63c36 100644 --- a/dbms/include/DB/Dictionaries/ClickhouseDictionarySource.h +++ b/dbms/include/DB/Dictionaries/ClickhouseDictionarySource.h @@ -28,19 +28,25 @@ public: table{config.getString(config_prefix + "table")}, sample_block{sample_block}, context(context), is_local{isLocal(host, port)}, - pool{/*is_local ? nullptr : */ext::make_unique( + pool{is_local ? nullptr : ext::make_unique( max_connections, host, port, db, user, password, context.getDataTypeFactory(), "ClickhouseDictionarySource") }, load_all_query{composeLoadAllQuery(sample_block, table)} - {} + { + if (is_local) + throw Exception{ + "Cannot use local clickhouse as a dictionary source", + ErrorCodes::LOGICAL_ERROR + }; + } ClickhouseDictionarySource(const ClickhouseDictionarySource & other) : host{other.host}, port{other.port}, user{other.user}, password{other.password}, db{other.db}, table{other.db}, sample_block{other.sample_block}, context(other.context), is_local{other.is_local}, - pool{/*is_local ? nullptr : */ext::make_unique( + pool{is_local ? nullptr : ext::make_unique( max_connections, host, port, db, user, password, context.getDataTypeFactory(), "ClickhouseDictionarySource")}, load_all_query{other.load_all_query}