diff --git a/tests/queries/0_stateless/02891_rename_table_without_keyword.reference b/tests/queries/0_stateless/02891_rename_table_without_keyword.reference index 3116f82ea085..958c53935c13 100644 --- a/tests/queries/0_stateless/02891_rename_table_without_keyword.reference +++ b/tests/queries/0_stateless/02891_rename_table_without_keyword.reference @@ -5,4 +5,3 @@ r1_bak r2_bak test_dictionary test_dictionary_2 -UNKNOWN_TABLE diff --git a/tests/queries/0_stateless/02891_rename_table_without_keyword.sh b/tests/queries/0_stateless/02891_rename_table_without_keyword.sh deleted file mode 100755 index 8d9d73f6ab40..000000000000 --- a/tests/queries/0_stateless/02891_rename_table_without_keyword.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env bash - -CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -# shellcheck source=../shell_config.sh -. "$CUR_DIR"/../shell_config.sh - -db_name=db_$(echo $RANDOM |md5sum |cut -c 1-4) - -$CLICKHOUSE_CLIENT --param_db="${db_name}" --multiquery \ - --query="DROP DATABASE IF EXISTS {db:Identifier}; - CREATE DATABASE {db:Identifier}; - CREATE TABLE IF NOT EXISTS {db:Identifier}.r1 (name String) Engine=Memory(); - SHOW TABLES FROM {db:Identifier}" - -$CLICKHOUSE_CLIENT --param_db="${db_name}" --multiquery \ - --query="RENAME TABLE {db:Identifier}.r1 TO {db:Identifier}.r1_bak; - SHOW TABLES FROM {db:Identifier};" - -$CLICKHOUSE_CLIENT --param_db="${db_name}" --multiquery \ - --query="RENAME {db:Identifier}.r1_bak TO {db:Identifier}.r1; - SHOW TABLES FROM {db:Identifier};" - -$CLICKHOUSE_CLIENT --param_db="${db_name}" --multiquery \ - --query="CREATE TABLE IF NOT EXISTS {db:Identifier}.r2 (name String) Engine=Memory(); - RENAME {db:Identifier}.r1 TO {db:Identifier}.r1_bak, {db:Identifier}.r2 TO {db:Identifier}.r2_bak; - SHOW TABLES FROM {db:Identifier};" - - -$CLICKHOUSE_CLIENT --param_db="${db_name}" --multiquery \ - --query="CREATE TABLE IF NOT EXISTS {db:Identifier}.source_table ( - id UInt64, - value String - ) ENGINE = Memory; - - CREATE DICTIONARY IF NOT EXISTS {db:Identifier}.test_dictionary - ( - id UInt64, - value String - ) - PRIMARY KEY id - SOURCE(CLICKHOUSE(TABLE '{db:Identifier}.source_table')) - LAYOUT(FLAT()) - LIFETIME(MIN 0 MAX 1000); - - SHOW DICTIONARIES FROM {db:Identifier};" - - -$CLICKHOUSE_CLIENT --param_db="${db_name}" --multiquery \ - --query="RENAME {db:Identifier}.test_dictionary TO {db:Identifier}.test_dictionary_2; - SHOW DICTIONARIES FROM {db:Identifier};" - -todb_name=db_$(echo $RANDOM |md5sum |cut -c 1-4) - -$CLICKHOUSE_CLIENT --param_todb="${todb_name}" --param_db="${db_name}" --query="RENAME {db:Identifier} TO {todb:Identifier}; -- { serverError 60 }" 2>&1 | grep -o "UNKNOWN_TABLE" | uniq - -$CLICKHOUSE_CLIENT --param_db="${db_name}" --query="DROP DATABASE IF EXISTS {db:Identifier}" - diff --git a/tests/queries/0_stateless/02891_rename_table_without_keyword.sql b/tests/queries/0_stateless/02891_rename_table_without_keyword.sql new file mode 100755 index 000000000000..2f32dc94deff --- /dev/null +++ b/tests/queries/0_stateless/02891_rename_table_without_keyword.sql @@ -0,0 +1,42 @@ +DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}; +CREATE DATABASE IF NOT EXISTS {CLICKHOUSE_DATABASE:Identifier}; + +CREATE TABLE IF NOT EXISTS {CLICKHOUSE_DATABASE:Identifier}.r1 (name String) Engine=Memory(); +SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier}; + +RENAME TABLE {CLICKHOUSE_DATABASE:Identifier}.r1 TO {CLICKHOUSE_DATABASE:Identifier}.r1_bak; +SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier}; + +RENAME {CLICKHOUSE_DATABASE:Identifier}.r1_bak TO {CLICKHOUSE_DATABASE:Identifier}.r1; +SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier}; + +CREATE TABLE IF NOT EXISTS {CLICKHOUSE_DATABASE:Identifier}.r2 (name String) Engine=Memory(); +RENAME {CLICKHOUSE_DATABASE:Identifier}.r1 TO {CLICKHOUSE_DATABASE:Identifier}.r1_bak, + {CLICKHOUSE_DATABASE:Identifier}.r2 TO {CLICKHOUSE_DATABASE:Identifier}.r2_bak; +SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier}; + +CREATE TABLE IF NOT EXISTS {CLICKHOUSE_DATABASE:Identifier}.source_table ( + id UInt64, + value String + ) ENGINE = Memory; + +CREATE DICTIONARY IF NOT EXISTS {CLICKHOUSE_DATABASE:Identifier}.test_dictionary +( + id UInt64, + value String +) +PRIMARY KEY id +SOURCE(CLICKHOUSE(TABLE '{CLICKHOUSE_DATABASE:String}.dictionary_table')) +LAYOUT(FLAT()) +LIFETIME(MIN 0 MAX 1000); + +SHOW DICTIONARIES FROM {CLICKHOUSE_DATABASE:Identifier}; + +RENAME {CLICKHOUSE_DATABASE:Identifier}.test_dictionary TO {CLICKHOUSE_DATABASE:Identifier}.test_dictionary_2; +SHOW DICTIONARIES FROM {CLICKHOUSE_DATABASE:Identifier}; + +SHOW DATABASES LIKE '{CLICKHOUSE_DATABASE:String}'; +RENAME {CLICKHOUSE_DATABASE:Identifier} TO {CLICKHOUSE_DATABASE_1:Identifier}; -- { serverError UNKNOWN_TABLE } +SHOW DATABASES LIKE '{CLICKHOUSE_DATABASE:String}'; + +DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};