When I create a table in MySQL and specify the table name, for example like this
create table test._tmp(id int primary key not null);
the database name is duplicated, which results in incorrect SQL in ClickHouse:
CREATE TABLE test2.test2._tmp
(
`id` Int32,
`_version` UInt64,
INDEX _version _version TYPE minmax GRANULARITY 1,
INDEX idx_id id TYPE bloom_filter GRANULARITY 1
)
ENGINE = ReplacingMergeTree(_version)
PARTITION BY intDiv(id, 4294967)
ORDER BY id
SETTINGS index_granularity = 8192
This is a problem for tools like Percona online schema change, which generates a temporary table using a fully qualified name during migrations.