From ba6a56a485f0b6f9511e0b597d047b6f0eeee3b1 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 5 Jan 2020 08:45:13 +0300 Subject: [PATCH] Added a comment --- dbms/src/Storages/StorageFile.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbms/src/Storages/StorageFile.cpp b/dbms/src/Storages/StorageFile.cpp index 27c0042c435..53c213eb1eb 100644 --- a/dbms/src/Storages/StorageFile.cpp +++ b/dbms/src/Storages/StorageFile.cpp @@ -369,6 +369,8 @@ void StorageFile::rename(const String & new_path_to_table_data, const String & n void StorageFile::truncate(const ASTPtr & /*query*/, const Context & /* context */, TableStructureWriteLockHolder &) { + /// NOTE: It will throw exception if the file is not created yet. + if (paths.size() != 1) throw Exception("Can't truncate table '" + table_name + "' in readonly mode", ErrorCodes::DATABASE_ACCESS_DENIED);