From d896e34cdd7f2da2c36794232b00c531e84ef2de Mon Sep 17 00:00:00 2001 From: kould Date: Sat, 24 Feb 2024 03:04:39 +0800 Subject: [PATCH] fix: `check_permission` for `Create Table ... Like` --- src/frontend/src/instance.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/instance.rs b/src/frontend/src/instance.rs index 7b32605639db..2f5b2735324e 100644 --- a/src/frontend/src/instance.rs +++ b/src/frontend/src/instance.rs @@ -460,10 +460,8 @@ pub fn check_permission( // database ops won't be checked Statement::CreateDatabase(_) | Statement::ShowDatabases(_) => {} // show create table and alter are not supported yet - Statement::ShowCreateTable(_) - | Statement::CreateExternalTable(_) - | Statement::CreateTableLike(_) - | Statement::Alter(_) => {} + Statement::ShowCreateTable(_) | Statement::CreateExternalTable(_) | Statement::Alter(_) => { + } // set/show variable now only alter/show variable in session Statement::SetVariables(_) | Statement::ShowVariables(_) => {} @@ -473,6 +471,10 @@ pub fn check_permission( Statement::CreateTable(stmt) => { validate_param(&stmt.name, query_ctx)?; } + Statement::CreateTableLike(stmt) => { + validate_param(&stmt.name, query_ctx)?; + validate_param(&stmt.target, query_ctx)?; + } Statement::DropTable(drop_stmt) => { validate_param(drop_stmt.table_name(), query_ctx)?; }