yujun777 commented on code in PR #63216:
URL: https://github.com/apache/doris/pull/63216#discussion_r3238925426


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/AlterMTMVRenameInfo.java:
##########
@@ -53,18 +53,25 @@ public AlterMTMVRenameInfo(TableNameInfo mvName, String 
newName) {
     public void analyze(ConnectContext ctx) throws AnalysisException {
         super.analyze(ctx);
         try {
-            FeNameFormat.checkTableName(newName);
+            FeNameFormat.checkTableName(newName.getTbl());
         } catch (org.apache.doris.common.AnalysisException e) {
             throw new AnalysisException(e.getMessage(), e);
         }
+        if (newName.getCtl() != null || newName.getDb() != null) {
+            newName.analyze(ctx.getNameSpaceContext());
+            if (!mvName.getCtl().equalsIgnoreCase(newName.getCtl())

Review Comment:
   这里建议不要用 `equalsIgnoreCase` 直接判断 catalog/db 相同。这个语法只是允许 target 写 
fully-qualified name,不应该表示支持 MV 迁移;如果 target catalog/db 和 source 
不完全是同一个解析后的对象,应当直接报错。否则大小写不同或未规范化的 db/catalog 名可能通过校验,但 `run()` 仍然只在 
`mvName.getDb()` 里执行 `renameTable(db, table, newName.getTbl())`,实际不会移动到 target 
db/catalog,SQL 语义会被误导。建议严格比较解析后的 catalog/db 名,并补充不同 db/catalog 的负例测试。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to