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

morrySnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 0fb9b450865 [fix](view) Skip dangling views when querying 
information_schema.view_dependency (#67339)
0fb9b450865 is described below

commit 0fb9b450865da73ffd5aa58de9643682552c1dc1
Author: yujun <[email protected]>
AuthorDate: Tue Sep 1 16:56:43 2026 +0800

    [fix](view) Skip dangling views when querying 
information_schema.view_dependency (#67339)
    
    `information_schema.view_dependency` re-parses each view definition to
    collect
    its base tables. When a view references a table that no longer exists
    (dangling view), the parse throws an exception and the whole metadata
    query
    fails instead of skipping the bad view.
    
    For example, after `CREATE VIEW v1 AS SELECT * FROM t1; DROP TABLE t1;`,
    `SELECT * FROM information_schema.view_dependency` fails with
    `Table [t1] does not exist in database [xxx]`.
---
 .../org/apache/doris/tablefunction/MetadataGenerator.java     | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
 
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
index c80dd544f81..09862b06c34 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
@@ -876,7 +876,16 @@ public class MetadataGenerator {
                         continue;
                     }
                     String inlineViewDef = ((View) table).getInlineViewDef();
-                    Map<List<String>, TableIf> tablesMap = 
PlanUtils.tableCollect(inlineViewDef, ctx);
+                    Map<List<String>, TableIf> tablesMap;
+                    try {
+                        tablesMap = PlanUtils.tableCollect(inlineViewDef, ctx);
+                    } catch (Exception e) {
+                        // A view may reference tables that no longer exist 
(dangling view).
+                        // Skip it so the whole metadata query does not fail.
+                        LOG.warn("Failed to collect base tables of view {} in 
database {}, skip it. exception: {}",
+                                tableName, dbName, e);
+                        continue;
+                    }
                     for (Map.Entry<List<String>, TableIf> info : 
tablesMap.entrySet()) {
                         List<String> fullName = info.getKey();
                         TableIf tbl = info.getValue();


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

Reply via email to