Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename table statement #3557

Closed
BohuTANG opened this issue Dec 20, 2021 · 7 comments · Fixed by #4425
Closed

Rename table statement #3557

BohuTANG opened this issue Dec 20, 2021 · 7 comments · Fixed by #4425
Assignees
Labels
C-feature Category: feature community-take good first issue Category: good first issue

Comments

@BohuTANG
Copy link
Member

Summary

RENAME TABLE old_table TO new_table;

https://dev.mysql.com/doc/refman/8.0/en/rename-table.html

@BohuTANG BohuTANG added C-feature Category: feature good first issue Category: good first issue labels Dec 20, 2021
@chenyukang
Copy link

/assign

@kevinw66
Copy link
Contributor

kevinw66 commented Jan 4, 2022

Is alter_table function needed in MetaApi ?

@BohuTANG
Copy link
Member Author

BohuTANG commented Jan 4, 2022

Is alter_table function needed in MetaApi ?

Yes, looks like we need.
But it seems we only update the database/table name with the db_id/table_id, @drmingdrmer and @dantengsky may help here

@junnplus
Copy link
Contributor

junnplus commented Mar 2, 2022

Is alter_table function needed in MetaApi ?

@kevinw66 @chenyukang
The last hurdle has been cleared at #4288 , sorry to finish so late. :(

@kevinw66
Copy link
Contributor

/assign

@kevinw66
Copy link
Contributor

@BohuTANG @junnplus The multiple table rename should support in meta api or I have to call api multiple times?

@junnplus
Copy link
Contributor

@kevinw66 I guess they can be non-atomic.

refer to https://clickhouse.com/docs/en/sql-reference/statements/rename/#misc_operations-rename_table

If you rename multiple tables in one query, the operation is not atomic. It may be partially executed, and queries in other sessions may get Table ... does not exist ... error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature community-take good first issue Category: good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants