Skip to content

chore(query): Rename table not allow modify catalog or database #14098

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

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/query/sql/src/planner/binder/ddl/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,9 +998,9 @@ impl Binder {
let (new_catalog, new_database, new_table) =
self.normalize_object_identifier_triple(new_catalog, new_database, new_table);

if new_catalog != catalog {
if new_catalog != catalog || new_database != database {
return Err(ErrorCode::BadArguments(
"alter catalog not allowed while rename table",
"Rename table not allow modify catalog or database",
));
Comment on lines +1001 to 1004
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if new_catalog != catalog || new_database != database {
return Err(ErrorCode::BadArguments(
"alter catalog not allowed while rename table",
"Rename table not allow modify catalog or database",
));
if new_catalog != catalog || new_database != database {
return Err(ErrorCode::BadArguments(
"Rename table not allow modify catalog or database",
))
.set_span(database.and_then(|ident| ident.span));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DROP TABLE t0
statement ok
SELECT * FROM t1

statement error 1002
statement error 1006
RENAME TABLE t1 to system.t1

statement ok
Expand Down Expand Up @@ -56,7 +56,7 @@ SELECT * FROM t1
----
1

statement error 1002
statement error 1006
RENAME TABLE t1 to system.t1

statement ok
Expand Down Expand Up @@ -90,7 +90,7 @@ SELECT * FROM t1
----
1

statement error 1002
statement error 1006
RENAME TABLE t1 to system.t1

statement ok
Expand Down