ClickHouse/tests/queries/0_stateless/01148_zookeeper_path_macros_unfolding.sql

50 lines
2.2 KiB
MySQL
Raw Normal View History

2022-04-13 14:51:59 +00:00
-- Tags: zookeeper, no-replicated-database, no-parallel, no-ordinary-database
2021-09-12 12:35:27 +00:00
2020-09-26 19:18:28 +00:00
DROP TABLE IF EXISTS rmt;
2022-04-13 14:51:59 +00:00
DROP TABLE IF EXISTS rmt1;
DROP TABLE IF EXISTS rmt2;
DROP TABLE IF EXISTS rmt3;
2020-09-26 19:18:28 +00:00
CREATE TABLE rmt (n UInt64, s String) ENGINE = ReplicatedMergeTree('/clickhouse/test_01148/{shard}/{database}/{table}', '{replica}') ORDER BY n;
SHOW CREATE TABLE rmt;
RENAME TABLE rmt TO rmt1;
DETACH TABLE rmt1;
ATTACH TABLE rmt1;
SHOW CREATE TABLE rmt1;
CREATE TABLE rmt (n UInt64, s String) ENGINE = ReplicatedMergeTree('{default_path_test}{uuid}', '{default_name_test}') ORDER BY n; -- { serverError 62 }
CREATE TABLE rmt (n UInt64, s String) ENGINE = ReplicatedMergeTree('{default_path_test}test_01148', '{default_name_test}') ORDER BY n;
SHOW CREATE TABLE rmt;
RENAME TABLE rmt TO rmt2; -- { serverError 48 }
DETACH TABLE rmt;
ATTACH TABLE rmt;
SHOW CREATE TABLE rmt;
SET distributed_ddl_output_mode='none';
2022-04-14 12:48:24 +00:00
DROP DATABASE IF EXISTS test_01148_atomic;
CREATE DATABASE test_01148_atomic ENGINE=Atomic;
CREATE TABLE test_01148_atomic.rmt2 ON CLUSTER test_shard_localhost (n int, PRIMARY KEY n) ENGINE=ReplicatedMergeTree;
CREATE TABLE test_01148_atomic.rmt3 AS test_01148_atomic.rmt2; -- { serverError 62 }
CREATE TABLE test_01148_atomic.rmt4 ON CLUSTER test_shard_localhost AS test_01148_atomic.rmt2;
SHOW CREATE TABLE test_01148_atomic.rmt2;
RENAME TABLE test_01148_atomic.rmt4 to test_01148_atomic.rmt3;
SHOW CREATE TABLE test_01148_atomic.rmt3;
2022-04-13 14:51:59 +00:00
DROP DATABASE IF EXISTS test_01148_ordinary;
2022-06-23 07:59:13 +00:00
set allow_deprecated_database_ordinary=1;
2022-04-13 14:51:59 +00:00
CREATE DATABASE test_01148_ordinary ENGINE=Ordinary;
2022-04-14 12:48:24 +00:00
RENAME TABLE test_01148_atomic.rmt3 to test_01148_ordinary.rmt3; -- { serverError 48 }
2022-04-13 14:51:59 +00:00
DROP DATABASE test_01148_ordinary;
2022-04-14 12:48:24 +00:00
DROP DATABASE test_01148_atomic;
2022-04-13 14:51:59 +00:00
2020-09-26 19:18:28 +00:00
DROP TABLE rmt;
DROP TABLE rmt1;
2022-04-13 14:51:59 +00:00
SET allow_experimental_database_replicated=1;
2022-04-13 14:51:59 +00:00
DROP DATABASE IF EXISTS imdb_01148;
CREATE DATABASE imdb_01148 ENGINE = Replicated('/test/databases/imdb_01148', '{shard}', '{replica}');
CREATE TABLE imdb_01148.movie_directors (`director_id` UInt64, `movie_id` UInt64) ENGINE = ReplicatedMergeTree ORDER BY (director_id, movie_id) SETTINGS index_granularity = 8192;
CREATE TABLE imdb_01148.anything AS imdb_01148.movie_directors;
SHOW CREATE TABLE imdb_01148.anything;
DROP DATABASE imdb_01148;