This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit eaacba644d0fc2ad8c9466f68b871a8f70609230
Author: zhangdong <493738...@qq.com>
AuthorDate: Wed Apr 24 21:46:45 2024 +0800

    [fix](auth)can not grant priv to __internal_schema (#34009)
    
    mysql> grant SELECT_PRIV on `_internal_schema`.* to 'test'@'%'; ERROR 1102 
(42000): errCode = 2, detailMessage = Incorrect database name '_internal_schema'
---
 .../org/apache/doris/analysis/TablePattern.java    | 13 ----------
 .../suites/auth_p0/test_grant_auth.groovy          | 28 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/TablePattern.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/TablePattern.java
index 398d3824624..4d3d9280e57 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/TablePattern.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/TablePattern.java
@@ -21,7 +21,6 @@ import org.apache.doris.catalog.Env;
 import org.apache.doris.cluster.ClusterNamespace;
 import org.apache.doris.common.AnalysisException;
 import org.apache.doris.common.FeMetaVersion;
-import org.apache.doris.common.FeNameFormat;
 import org.apache.doris.common.io.Text;
 import org.apache.doris.common.io.Writable;
 import org.apache.doris.datasource.InternalCatalog;
@@ -124,18 +123,6 @@ public class TablePattern implements Writable, 
GsonPostProcessable {
                 || (!db.equals("*") && ctl.equals("*"))) {
             throw new AnalysisException("Do not support format: " + 
toString());
         }
-
-        if (!ctl.equals("*")) {
-            FeNameFormat.checkCatalogName(ctl);
-        }
-
-        if (!db.equals("*")) {
-            FeNameFormat.checkDbName(db);
-        }
-
-        if (!tbl.equals("*")) {
-            FeNameFormat.checkTableName(tbl);
-        }
         isAnalyzed = true;
     }
 
diff --git a/regression-test/suites/auth_p0/test_grant_auth.groovy 
b/regression-test/suites/auth_p0/test_grant_auth.groovy
new file mode 100644
index 00000000000..fd3f51a4081
--- /dev/null
+++ b/regression-test/suites/auth_p0/test_grant_auth.groovy
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import org.junit.Assert;
+
+suite("test_grant_auth","p0,auth") {
+    String user = 'test_grant_auth_user'
+    String pwd = 'C123_567p'
+    try_sql("DROP USER ${user}")
+    sql """CREATE USER '${user}' IDENTIFIED BY '${pwd}'"""
+    sql """grant select_priv on `_internal_schema`.* to ${user}"""
+
+    try_sql("DROP USER ${user}")
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to