

such as
```
create view view1 as 
with t as (select number n from numbers(3))
select n from t
```
{
        if (create.as_table_function && (create.columns_list->indices || create.columns_list->constraints))
            throw Exception("Indexes and constraints are not supported for table functions", ErrorCodes::INCORRECT_QUERY);
        if (create.columns_list->columns)
        {
            bool sanity_check_compression_codecs = !create.attach && !getContext()->getSettingsRef().allow_suspicious_codecs;
            properties.columns = getColumnsDescription(*create.columns_list->columns, getContext(), sanity_check_compression_codecs);
        }
        if (create.columns_list->indices)
            for (const auto & index : create.columns_list->indices->children)
                properties.indices.push_back(
                    IndexDescription::getIndexFromAST(index->clone(), properties.columns, getContext()));
        properties.constraints = getConstraintsDescription(create.columns_list->constraints);
    }
    else if (!create.as_table.empty())
    {
        String as_database_name = getContext()->resolveDatabase(create.as_database);
        StoragePtr as_storage = DatabaseCatalog::instance().getTable({as_database_name, create.as_table}, getContext());
        
        as_storage_lock = as_storage->lockForShare(getContext()->getCurrentQueryId(), getContext()->getSettingsRef().lock_acquire_timeout);
        auto as_storage_metadata = as_storage->getInMemoryMetadataPtr();
        properties.columns = as_storage_metadata->getColumns();
        
        
        if (create.storage && endsWith(create.storage->engine->name, "MergeTree"))
            properties.indices = as_storage_metadata->getSecondaryIndices();
        properties.constraints = as_storage_metadata->getConstraints();
    }
    else if (create.select)
    {