diff --git a/dbms/src/Databases/DatabasesCommon.cpp b/dbms/src/Databases/DatabasesCommon.cpp index d2164b5f5e9..73717acf507 100644 --- a/dbms/src/Databases/DatabasesCommon.cpp +++ b/dbms/src/Databases/DatabasesCommon.cpp @@ -35,7 +35,7 @@ String getTableDefinitionFromCreateQuery(const ASTPtr & query) create.select = nullptr; /// For "MATERIALIZED VIEW x TO y" it's necessary to save destination table - if (!(create.is_materialized_view && !create.storage)) + if (!create.is_materialized_view || create.storage) { create.as_database.clear(); create.as_table.clear(); diff --git a/dbms/src/Parsers/ParserCreateQuery.cpp b/dbms/src/Parsers/ParserCreateQuery.cpp index ce97297258a..35b9781b2a6 100644 --- a/dbms/src/Parsers/ParserCreateQuery.cpp +++ b/dbms/src/Parsers/ParserCreateQuery.cpp @@ -364,6 +364,8 @@ bool ParserCreateQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) { to_table = true; + /// FIXME: as_table is ambiguous, it is set in AS clause also + if (!name_p.parse(pos, as_table, expected)) return false; diff --git a/dbms/src/Storages/StorageFactory.cpp b/dbms/src/Storages/StorageFactory.cpp index 9ce1895b638..d6bcb9da42f 100644 --- a/dbms/src/Storages/StorageFactory.cpp +++ b/dbms/src/Storages/StorageFactory.cpp @@ -808,7 +808,7 @@ StoragePtr StorageFactory::get( merging_params.mode = MergeTreeData::MergingParams::Ordinary; const bool allow_extended_storage_def = - local_context.getSettingsRef().experimental_allow_extended_storage_definition_syntax; + attach || local_context.getSettingsRef().experimental_allow_extended_storage_definition_syntax; if (name_part == "Collapsing") merging_params.mode = MergeTreeData::MergingParams::Collapsing; diff --git a/dbms/src/Storages/StorageMaterializedView.cpp b/dbms/src/Storages/StorageMaterializedView.cpp index 403d80c641d..778dffdf42c 100644 --- a/dbms/src/Storages/StorageMaterializedView.cpp +++ b/dbms/src/Storages/StorageMaterializedView.cpp @@ -81,7 +81,7 @@ StorageMaterializedView::StorageMaterializedView( DatabaseAndTableName(database_name, table_name)); // If the destination table is not set, use inner table - if (!query.storage) + if (!query.as_table.empty()) { target_database_name = query.as_database; target_table_name = query.as_table; diff --git a/dbms/tests/queries/0_stateless/00429_http_bufferization.sh b/dbms/tests/queries/0_stateless/00429_http_bufferization.sh index 8946d798c7b..b47cbc5b00d 100755 --- a/dbms/tests/queries/0_stateless/00429_http_bufferization.sh +++ b/dbms/tests/queries/0_stateless/00429_http_bufferization.sh @@ -5,7 +5,8 @@ max_block_size=100 URL='http://localhost:8123/' function query { - echo "SELECT toUInt8(intHash64(number)) FROM system.numbers LIMIT $1 FORMAT RowBinary" + # bash isn't able to store \0 bytes, so use [1; 255] random range + echo "SELECT greatest(toUInt8(1), toUInt8(intHash64(number))) FROM system.numbers LIMIT $1 FORMAT RowBinary" } function ch_url() { @@ -81,13 +82,12 @@ check_cli_and_http # Check HTTP internal compression in normal case -# Skip if clickhouse-compressor not installed function cmp_http_compression() { clickhouse-client -q "`query $1`" > res0 - ch_url 'compress=1' $1 | clickhouse-compressor --decompress > res1 - ch_url "compress=1&buffer_size=$2&wait_end_of_query=0" $1 | clickhouse-compressor --decompress > res2 - ch_url "compress=1&buffer_size=$2&wait_end_of_query=1" $1 | clickhouse-compressor --decompress > res3 + ch_url 'compress=1' $1 | clickhouse compressor --decompress > res1 + ch_url "compress=1&buffer_size=$2&wait_end_of_query=0" $1 | clickhouse compressor --decompress > res2 + ch_url "compress=1&buffer_size=$2&wait_end_of_query=1" $1 | clickhouse compressor --decompress > res3 cmp res0 res1 cmp res1 res2 cmp res1 res3 @@ -103,8 +103,4 @@ function check_http_compression() { done } -has_compressor=$(command -v clickhouse-compressor &>/dev/null && echo 1 || echo 0) - -if [[ $has_compressor -eq 1 ]]; then - check_http_compression -fi +check_http_compression diff --git a/dbms/tests/queries/0_stateless/00508_materialized_view_to.sql b/dbms/tests/queries/0_stateless/00508_materialized_view_to.sql index d2a819ec623..e327f131b23 100644 --- a/dbms/tests/queries/0_stateless/00508_materialized_view_to.sql +++ b/dbms/tests/queries/0_stateless/00508_materialized_view_to.sql @@ -3,7 +3,7 @@ DROP TABLE IF EXISTS test.dst; DROP TABLE IF EXISTS test.mv; CREATE TABLE test.src (x UInt8) ENGINE = Null; -CREATE TABLE test.dst (x UInt8) ENGINE = Memory(); +CREATE TABLE test.dst (x UInt8) ENGINE = Memory; CREATE MATERIALIZED VIEW test.mv TO test.dst AS SELECT * FROM test.src; INSERT INTO test.src VALUES (1), (2);