

such as
```
create view view1 as 
with t as (select number n from numbers(3))
select n from t
```
{
    
    if (create.temporary && !create.database.empty())
        throw Exception("Temporary tables cannot be inside a database. You should not specify a database for a temporary table.",
            ErrorCodes::BAD_DATABASE_FOR_TEMPORARY_TABLE);
    String current_database = getContext()->getCurrentDatabase();
    auto database_name = create.database.empty() ? current_database : create.database;
    
    if (create.attach && !create.storage && !create.columns_list)
    {
        auto database = DatabaseCatalog::instance().getDatabase(database_name);
        if (database->getEngineName() == "Replicated")
        {
            auto guard = DatabaseCatalog::instance().getDDLGuard(database_name, create.table);
            if (typeid_cast<DatabaseReplicated *>(database.get()) && getContext()->getClientInfo().query_kind != ClientInfo::QueryKind::SECONDARY_QUERY)
            {
                create.database = database_name;
                guard->releaseTableLock();
                return typeid_cast<DatabaseReplicated *>(database.get())->tryEnqueueReplicatedDDL(query_ptr, getContext());
            }
        }
        bool if_not_exists = create.if_not_exists;
        
        auto query = database->getCreateTableQuery(create.table, getContext());
        create = query->as<ASTCreateQuery &>(); 
        if (create.is_dictionary)
            throw Exception(ErrorCodes::INCORRECT_QUERY,
                            "Cannot ATTACH TABLE {}.{}, it is a Dictionary",
                            backQuoteIfNeed(database_name), backQuoteIfNeed(create.table));