Altinity / clickhouse-backup

Tool for easy backup and restore for ClickHouse® using object storage for backup files.
https://altinity.com
Other
1.25k stars 225 forks source link

restore backup error when table name and field name are same #297

Closed goto217 closed 2 years ago

goto217 commented 2 years ago

clickhouse-backup version: 1.2.1

i backup table , the table name and field name are same.

 CREATE TABLE test.mm ( `mm` String ) ENGINE = ReplacingMergeTree ORDER BY mm SETTINGS index_granularity = 8192

backup success, but restore failed error message:

warn can't create table 'test.mm': code: 62, message: Syntax error: failed at position 35 ('.'): .`mm` String) ENGINE = ReplacingMergeTree ORDER BY mm SETTINGS index_granularity = 8192. Expected one of: nested table, ALIAS, identifier, DEFAULT, data type, MATERIALIZED, will try again backup=/2021-11-01T06-08-50 operation=restore
Slach commented 2 years ago

Thanks a lot for reporting, could you share results of following commands:

LOG_LEVEL=debug clickhouse-backup restore --table=test.mm

goto217 commented 2 years ago

@Slach error message :

[root@restserver clickhouse-backup]# LOG_LEVEL=debug ./clickhouse-backup --config ./config.yml restore /2021-11-17T08-26-40
2021/11/17 16:30:25 debug SELECT value FROM `system`.`build_options` where name='VERSION_INTEGER'
2021/11/17 16:30:25 debug SELECT * FROM system.disks;
2021/11/17 16:30:25 debug CREATE DATABASE IF NOT EXISTS default
ENGINE = Atomic
2021/11/17 16:30:25 debug CREATE DATABASE IF NOT EXISTS test
ENGINE = Atomic
2021/11/17 16:30:25 debug SELECT * FROM system.disks;
2021/11/17 16:30:25 debug CREATE DATABASE IF NOT EXISTS `test`
2021/11/17 16:30:25 debug SELECT engine FROM system.databases WHERE name = 'test'
2021/11/17 16:30:25 debug CREATE TABLE test.mm UUID '6a569cf0-0d7a-4ca8-aa56-9cf00d7acca8' (`test`.`mm` String) ENGINE = ReplacingMergeTree ORDER BY mm SETTINGS index_granularity = 8192
2021/11/17 16:30:25 error can't create table `test`.`mm`: code: 62, message: Syntax error: failed at position 73 ('.'): .`mm` String) ENGINE = ReplacingMergeTree ORDER BY mm SETTINGS index_granularity = 8192. Expected one of: nested table, ALIAS, identifier, DEFAULT, data type, MATERIALIZED after 1 times, please check your schema dependencies
[root@restserver clickhouse-backup]#