**Describe the bug**
Creating a table as a table that was created using the numbers() causes an issue and disconnects the client.

**How to reproduce**
* ClickHouse server version
version 20.10.3.30

* `CREATE TABLE` statements for all tables involved
```
CREATE TABLE table2 AS numbers(5)
CREATE TABLE table3 AS table2
```

* Queries to run that lead to unexpected result
```
:) create table table2 as numbers(5)

CREATE TABLE table2 AS numbers(5)

Ok.

0 rows in set. Elapsed: 0.010 sec.

:) create table table3 as table2

CREATE TABLE table3 AS table2

[altinity-qa-cosmic2] 2020.11.12 19:01:54.258464 [ 179463 ] <Fatal> BaseDaemon: ########################################
[altinity-qa-cosmic2] 2020.11.12 19:01:54.258700 [ 179463 ] <Fatal> BaseDaemon: (version 20.10.3.30 (official build), build id: 4EAF0337F53BC2B4) (from thread 171354) (query_id: 0ac2afaa-12be-4a98-9767-5c8cd373f8d0) Received signal Segmentation fault (11)
[altinity-qa-cosmic2] 2020.11.12 19:01:54.258816 [ 179463 ] <Fatal> BaseDaemon: Address: 0x8 Access: read. Address not mapped to object.
[altinity-qa-cosmic2] 2020.11.12 19:01:54.258936 [ 179463 ] <Fatal> BaseDaemon: Stack trace: 0xdabc4e0 0xdabaa67 0xdabdf8a 0xdac0ff7 0xdec8f18 0xdec7dbd 0xe568ea6 0xe575ca7 0x10d4dd6f 0x10d4f77e 0x10e80a39 0x10e7c96a 0x7f25602076db 0x7f255fb2471f
[altinity-qa-cosmic2] 2020.11.12 19:01:54.259089 [ 179463 ] <Fatal> BaseDaemon: 2. DB::InterpreterCreateQuery::setEngine(DB::ASTCreateQuery&) const @ 0xdabc4e0 in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.259200 [ 179463 ] <Fatal> BaseDaemon: 3. DB::InterpreterCreateQuery::setProperties(DB::ASTCreateQuery&) const @ 0xdabaa67 in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.259295 [ 179463 ] <Fatal> BaseDaemon: 4. DB::InterpreterCreateQuery::createTable(DB::ASTCreateQuery&) @ 0xdabdf8a in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.259412 [ 179463 ] <Fatal> BaseDaemon: 5. DB::InterpreterCreateQuery::execute() @ 0xdac0ff7 in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.259517 [ 179463 ] <Fatal> BaseDaemon: 6. ? @ 0xdec8f18 in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.259632 [ 179463 ] <Fatal> BaseDaemon: 7. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool) @ 0xdec7dbd in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.259776 [ 179463 ] <Fatal> BaseDaemon: 8. DB::TCPHandler::runImpl() @ 0xe568ea6 in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.259851 [ 179463 ] <Fatal> BaseDaemon: 9. DB::TCPHandler::run() @ 0xe575ca7 in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.259951 [ 179463 ] <Fatal> BaseDaemon: 10. Poco::Net::TCPServerConnection::start() @ 0x10d4dd6f in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.260053 [ 179463 ] <Fatal> BaseDaemon: 11. Poco::Net::TCPServerDispatcher::run() @ 0x10d4f77e in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.260168 [ 179463 ] <Fatal> BaseDaemon: 12. Poco::PooledThread::run() @ 0x10e80a39 in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.260272 [ 179463 ] <Fatal> BaseDaemon: 13. Poco::ThreadImpl::runnableEntry(void*) @ 0x10e7c96a in /usr/bin/clickhouse
[altinity-qa-cosmic2] 2020.11.12 19:01:54.260353 [ 179463 ] <Fatal> BaseDaemon: 14. start_thread @ 0x76db in /lib/x86_64-linux-gnu/libpthread-2.27.so
[altinity-qa-cosmic2] 2020.11.12 19:01:54.260467 [ 179463 ] <Fatal> BaseDaemon: 15. __clone @ 0x12171f in /lib/x86_64-linux-gnu/libc-2.27.so

Exception on client:
Code: 32. DB::Exception: Attempt to read after eof: while receiving packet from localhost:9000

Connecting to localhost:9000 as user default.
Code: 210. DB::NetException: Connection refused (localhost:9000)

```
extern const int BAD_ARGUMENTS;
    extern const int BAD_DATABASE_FOR_TEMPORARY_TABLE;
    extern const int SUSPICIOUS_TYPE_FOR_LOW_CARDINALITY;
    extern const int DICTIONARY_ALREADY_EXISTS;
    extern const int ILLEGAL_SYNTAX_FOR_DATA_TYPE;
    extern const int ILLEGAL_COLUMN;
}
namespace fs = std::filesystem;
InterpreterCreateQuery::InterpreterCreateQuery(const ASTPtr & query_ptr_, Context & context_)
    : query_ptr(query_ptr_), context(context_)
{
}
BlockIO InterpreterCreateQuery::createDatabase(ASTCreateQuery & create)
{
    String database_name = create.database;
    auto guard = DatabaseCatalog::instance().getDDLGuard(database_name, "");
    
    if (DatabaseCatalog::instance().isDatabaseExist(database_name))
    {
        if (create.if_not_exists)
            return {};
        else
            throw Exception("Database " + database_name + " already exists.", ErrorCodes::DATABASE_ALREADY_EXISTS);
    }
    
    String database_name_escaped = escapeForFileName(database_name);
    fs::path metadata_path = fs::canonical(context.getPath());
    fs::path metadata_file_tmp_path = metadata_path / "metadata" / (database_name_escaped + ".sql.tmp");
    fs::path metadata_file_path = metadata_path / "metadata" / (database_name_escaped + ".sql");
    if (!create.storage && create.attach)