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
Support rename table without keyword TABLE #55373
Support rename table without keyword TABLE #55373
Conversation
60fe7c5
to
8f82d64
Compare
This is an automated comment for commit e646fb7 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page Successful checks
|
413c190
to
2116377
Compare
tests/queries/0_stateless/02891_rename_table_without_keyword.sql
Outdated
Show resolved
Hide resolved
408f570
to
6af3241
Compare
tests/queries/0_stateless/02891_rename_table_without_keyword.sql
Outdated
Show resolved
Hide resolved
tests/queries/0_stateless/02891_rename_table_without_keyword.reference
Outdated
Show resolved
Hide resolved
So it seems it also renames dictionaries. I am not sure if that is good or not. Let me check. |
I've tried rename dictionary with statement |
Master branch can also rename dictionary via using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last request from me: could you please change the docs to mention that RENAME TABLE
now should also work just as RENAME
in docs/en/sql-reference/statements/rename.md
? Don't forget to update the syntax of the RENAME command on the top of the page: instead of RENAME DATABASE|TABLE|DICTIONARY
it should be RENAME [DATABASE|TABLE|DICTIONARY]
I think.
tests/queries/0_stateless/02891_rename_table_without_keyword.sql
Outdated
Show resolved
Hide resolved
82948f2
to
51a5703
Compare
The failed test does not appear to be related to this change, should I ignore them ? |
$CLICKHOUSE_CLIENT --param_db="$db_name" --multiquery \ | ||
--query="CREATE DATABASE {db:Identifier}; | ||
CREATE TABLE IF NOT EXISTS {db:Identifier}.r1 (name String) Engine=Memory(); | ||
SHOW TABLES FROM {db:Identifier}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what @tavplubix was referring to (thanks for catching this!) is to use {CLICKHOUSE_DATABASE:Identifier}
as a param for database name. It is appended by clickhouse-test
(see here), so you don't need to manually generate anything.
Conveniently we also append CLICKHOUSE_DATABASE_1
identifier, so you can use that to rename the database to, so the last query can be written like
RENAME {CLICKHOUSE_DATABASE:Identifier} TO {CLICKHOUSE_DATABASE_1:Identifier}; -- { serverError UNKNOWN_TABLE }
As a result as we don't need anything generated, we can revert back the tests to the simpler sql file instead of running a shell script in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it doesn't make sense for .sh tests because in .sh tests we have $CLICKHOUSE_DATABASE
env var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I undertand what you mean and I've update the test script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried use {CLICKHOUSE_DATABASE:Identifier}
, but there were some strange problems. So I think using the current test script should also be ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed the test using SQL files. Usually we prefer to use SQL files. The reasons I am aware of:
- They are simpler than the script based tests
- The queries in SQL scripts are picked up by the fuzzer and used to fuzz ClickHouse.
I hope you don't mind that I pushed a commit, but I think this make the tests better and it was easier for me. On the other hand, if you have any questions regarding to the test file, I am more than happy to answer it. If you want to understand why it wasn't working for you, I am also happy to help you, just show the errors you faced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx for your helping.
1192180
to
1886be8
Compare
1886be8
to
4499dd3
Compare
84fc959
to
89d123d
Compare
I think the failed test |
The failure might be connected to #55035 |
eeff98f
into
ClickHouse:master
Original issue : #55017
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Support rename table without keyword
TABLE
likeRENAME db.t1 to db.t2
Documentation entry for user-facing changes