```
:) create table t as remote('localhost', 'system', 'numbers')
Ok.
:) alter table t add column col UInt8

2020.08.28 13:17:23.463419 [ 54617 ] {} <Fatal> BaseDaemon: ########################################
2020.08.28 13:17:23.464248 [ 54617 ] {} <Fatal> BaseDaemon: (version 20.8.1.1, build id: 7BF608A90FDC580802F2787C9686E2BF9B8B8690) (from thread 53812) (query_id: 786c56f5-1258-452b-87fe-9daa251d8421) Received signal Segmentation fault (11)
2020.08.28 13:17:23.464750 [ 54617 ] {} <Fatal> BaseDaemon: Address: 0x18 Access: read. Address not mapped to object.
2020.08.28 13:17:23.465088 [ 54617 ] {} <Fatal> BaseDaemon: Stack trace: 0x1a523f50 0x244528d1 0x251c5cbb 0x247b67b9 0x2550a2b0 0x246475d7 0x246465ca 0x24d27e56 0x24d2f2e8 0x2912d2dc 0x2912daec 0x29261953 0x2925e87d 0x2925d708 0x7fc65a0ca6db 0x7fc6599e7a3f
2020.08.28 13:17:23.466378 [ 54617 ] {} <Fatal> BaseDaemon: 4. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/libcxx/include/vector:1516: std::__1::vector<std::__1::shared_ptr<DB::IAST>, std::__1::allocator<std::__1::shared_ptr<DB::IAST> > >::begin() @ 0x1a523f50 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:23.516644 [ 54617 ] {} <Fatal> BaseDaemon: 5. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Parsers/IAST.h:137: void DB::IAST::replace<DB::ASTExpressionList>(DB::ASTExpressionList*&, std::__1::shared_ptr<DB::IAST> const&) @ 0x244528d1 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:23.574161 [ 54617 ] {} <Fatal> BaseDaemon: 6. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Databases/DatabaseOrdinary.cpp:256: DB::DatabaseOrdinary::alterTable(DB::Context const&, DB::StorageID const&, DB::StorageInMemoryMetadata const&) @ 0x251c5cbb in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:23.623410 [ 54617 ] {} <Fatal> BaseDaemon: 7. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Storages/StorageDistributed.cpp:571: DB::StorageDistributed::alter(DB::AlterCommands const&, DB::Context const&, std::__1::shared_ptr<DB::RWLockImpl::LockHolderImpl>&) @ 0x247b67b9 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:23.681801 [ 54617 ] {} <Fatal> BaseDaemon: 8. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Interpreters/InterpreterAlterQuery.cpp:116: DB::InterpreterAlterQuery::execute() @ 0x2550a2b0 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:23.729923 [ 54617 ] {} <Fatal> BaseDaemon: 9. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Interpreters/executeQuery.cpp:389: DB::executeQueryImpl(char const*, char const*, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool, DB::ReadBuffer*) @ 0x246475d7 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:23.778408 [ 54617 ] {} <Fatal> BaseDaemon: 10. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Interpreters/executeQuery.cpp:675: DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool) @ 0x246465ca in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:23.831537 [ 54617 ] {} <Fatal> BaseDaemon: 11. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Server/TCPHandler.cpp:253: DB::TCPHandler::runImpl() @ 0x24d27e56 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:23.885341 [ 54617 ] {} <Fatal> BaseDaemon: 12. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Server/TCPHandler.cpp:1213: DB::TCPHandler::run() @ 0x24d2f2e8 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:23.951200 [ 54617 ] {} <Fatal> BaseDaemon: 13. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Net/src/TCPServerConnection.cpp:43: Poco::Net::TCPServerConnection::start() @ 0x2912d2dc in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:24.016951 [ 54617 ] {} <Fatal> BaseDaemon: 14. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Net/src/TCPServerDispatcher.cpp:114: Poco::Net::TCPServerDispatcher::run() @ 0x2912daec in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:24.083515 [ 54617 ] {} <Fatal> BaseDaemon: 15. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Foundation/src/ThreadPool.cpp:199: Poco::PooledThread::run() @ 0x29261953 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:24.149301 [ 54617 ] {} <Fatal> BaseDaemon: 16. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Foundation/src/Thread.cpp:56: Poco::(anonymous namespace)::RunnableHolder::run() @ 0x2925e87d in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:24.215992 [ 54617 ] {} <Fatal> BaseDaemon: 17. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345: Poco::ThreadImpl::runnableEntry(void*) @ 0x2925d708 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
2020.08.28 13:17:24.216596 [ 54617 ] {} <Fatal> BaseDaemon: 18. start_thread @ 0x76db in /lib/x86_64-linux-gnu/libpthread-2.27.so
2020.08.28 13:17:24.217218 [ 54617 ] {} <Fatal> BaseDaemon: 19. /build/glibc-2ORdQG/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97: __clone @ 0x121a3f in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.27.so

```

"in file " + table_metadata_path,
        0,
        context.getSettingsRef().max_parser_depth);
    auto & ast_create_query = ast->as<ASTCreateQuery &>();
    ASTPtr new_columns = InterpreterCreateQuery::formatColumns(metadata.columns);
    ASTPtr new_indices = InterpreterCreateQuery::formatIndices(metadata.secondary_indices);
    ASTPtr new_constraints = InterpreterCreateQuery::formatConstraints(metadata.constraints);
    ast_create_query.columns_list->replace(ast_create_query.columns_list->columns, new_columns);
    ast_create_query.columns_list->setOrReplace(ast_create_query.columns_list->indices, new_indices);
    ast_create_query.columns_list->setOrReplace(ast_create_query.columns_list->constraints, new_constraints);
    if (metadata.select.select_query)
    {
        ast->replace(ast_create_query.select, metadata.select.select_query);
    }
    
    if (ast_create_query.storage)
    {
        ASTStorage & storage_ast = *ast_create_query.storage;
        bool is_extended_storage_def
            = storage_ast.partition_by || storage_ast.primary_key || storage_ast.order_by || storage_ast.sample_by || storage_ast.settings;
        if (is_extended_storage_def)
        {
            if (metadata.sorting_key.definition_ast)
                storage_ast.set(storage_ast.order_by, metadata.sorting_key.definition_ast);
            if (metadata.primary_key.definition_ast)
                storage_ast.set(storage_ast.primary_key, metadata.primary_key.definition_ast);
            if (metadata.sampling_key.definition_ast)
                storage_ast.set(storage_ast.sample_by, metadata.sampling_key.definition_ast);
            if (metadata.table_ttl.definition_ast)
                storage_ast.set(storage_ast.ttl_table, metadata.table_ttl.definition_ast);