```
create table test (x UInt64) engine=Null;
insert into function remote('127.0.0.1',default,test) values (1);
-- ok
set async_insert=1;
insert into function remote('127.0.0.1',default,test) values (1);
-- fail
```

exception

```
Received exception from server (version 22.3.1):
Code: 60. DB::Exception: Received from localhost:9000. DB::Exception: Both table name and UUID are empty. Stack trace:

0. ./build_docker/../contrib/libcxx/include/exception:133: Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x15bff96c in /usr/bin/clickhouse
1. ./build_docker/../src/Common/Exception.cpp:58: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xa8d817a in /usr/bin/clickhouse
2. DB::StorageID::assertNotEmpty() const @ 0x10225ff1 in /usr/bin/clickhouse
3. ./build_docker/../contrib/libcxx/include/string:1444: DB::StorageID::getDatabaseName() const @ 0x131ec0d6 in /usr/bin/clickhouse
4. ./build_docker/../src/Interpreters/Context.cpp:0: DB::Context::checkAccess(DB::AccessFlags const&, DB::StorageID const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) const @ 0x12b96564 in /usr/bin/clickhouse
5. ./build_docker/../contrib/libcxx/include/vector:463: DB::AsynchronousInsertQueue::push(std::__1::shared_ptr<DB::IAST>, std::__1::shared_ptr<DB::Context const>) @ 0x12b61130 in /usr/bin/clickhouse
6. ./build_docker/../src/Interpreters/executeQuery.cpp:0: DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) @ 0x132fbb4e in /usr/bin/clickhouse
7. ./build_docker/../src/Interpreters/executeQuery.cpp:985: DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) @ 0x132fa4cd in /usr/bin/clickhouse
8. ./build_docker/../src/Server/TCPHandler.cpp:0: DB::TCPHandler::runImpl() @ 0x13b66440 in /usr/bin/clickhouse
9. ./build_docker/../src/Server/TCPHandler.cpp:1918: DB::TCPHandler::run() @ 0x13b75759 in /usr/bin/clickhouse
10. ./build_docker/../contrib/poco/Net/src/TCPServerConnection.cpp:57: Poco::Net::TCPServerConnection::start() @ 0x15aef967 in /usr/bin/clickhouse
11. ./build_docker/../contrib/libcxx/include/memory:1397: Poco::Net::TCPServerDispatcher::run() @ 0x15aefe27 in /usr/bin/clickhouse
12. ./build_docker/../contrib/poco/Foundation/src/ThreadPool.cpp:213: Poco::PooledThread::run() @ 0x15c619e7 in /usr/bin/clickhouse
13. ./build_docker/../contrib/poco/Foundation/include/Poco/SharedPtr.h:156: Poco::ThreadImpl::runnableEntry(void*) @ 0x15c5f3c6 in /usr/bin/clickhouse
14. ? @ 0x7f742d0b7609 in ?
15. clone @ 0x7f742cfde293 in ?
. (UNKNOWN_TABLE)
```
{
    query = query->clone();
    const auto & settings = query_context->getSettingsRef();
    auto & insert_query = query->as<ASTInsertQuery &>();
    InterpreterInsertQuery interpreter(query, query_context, settings.insert_allow_materialized_columns);
    auto table = interpreter.getTable(insert_query);
    auto sample_block = interpreter.getSampleBlock(insert_query, table, table->getInMemoryMetadataPtr());
    if (!FormatFactory::instance().isInputFormat(insert_query.format))
        throw Exception(ErrorCodes::UNKNOWN_FORMAT, "Unknown input format {}", insert_query.format);
    query_context->checkAccess(AccessType::INSERT, insert_query.table_id, sample_block.getNames());
    String bytes;
    {
        auto read_buf = getReadBufferFromASTInsertQuery(query);
        WriteBufferFromString write_buf(bytes);
        copyData(*read_buf, write_buf);
    }
    auto entry = std::make_shared<InsertData::Entry>(std::move(bytes), query_context->getCurrentQueryId());
    InsertQuery key{query, settings};
    {
        
        std::shared_lock read_lock(rwlock);
        if (auto it = queue.find(key); it != queue.end())