Skip to content

Commit

Permalink
Use SQL test
Browse files Browse the repository at this point in the history
  • Loading branch information
antaljanosbenjamin committed Oct 12, 2023
1 parent ca6975a commit 2fd2352
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ r1_bak
r2_bak
test_dictionary
test_dictionary_2
UNKNOWN_TABLE
57 changes: 0 additions & 57 deletions tests/queries/0_stateless/02891_rename_table_without_keyword.sh

This file was deleted.

42 changes: 42 additions & 0 deletions tests/queries/0_stateless/02891_rename_table_without_keyword.sql
Original file line number Diff line number Diff line change
@@ -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};

0 comments on commit 2fd2352

Please sign in to comment.