whitelist /dev/null in StorageFile

This commit is contained in:
Amos Bird 2019-12-29 15:03:39 +08:00
parent 49cfe326e3
commit 84c7589c9a
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
2 changed files with 3 additions and 2 deletions

View File

@ -108,7 +108,8 @@ static void checkCreationIsAllowed(const Context & context_global, const std::st
if (context_global.getApplicationType() != Context::ApplicationType::SERVER)
return;
if (!startsWith(table_path, db_dir_path))
/// "/dev/null" is allowed for perf testing
if (!startsWith(table_path, db_dir_path) && table_path != "/dev/null")
throw Exception("Part path " + table_path + " is not inside " + db_dir_path, ErrorCodes::DATABASE_ACCESS_DENIED);
Poco::File table_path_poco_file = Poco::File(table_path);

View File

@ -1,7 +1,7 @@
<test>
<type>loop</type>
<create_query>CREATE TABLE IF NOT EXISTS table_{format} ENGINE = File({format}) AS test.hits</create_query>
<create_query>CREATE TABLE IF NOT EXISTS table_{format} ENGINE = File({format}, '/dev/null') AS test.hits</create_query>
<stop_conditions>
<all_of>