You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/09/03 16:14:04 UTC

(datafusion-sqlparser-rs) branch gh-readonly-queue/main/pr-2442-0821cbdd5cbdc27f9c7205466d357deef632c936 created (now cbade61b)

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

github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-2442-0821cbdd5cbdc27f9c7205466d357deef632c936
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git


      at cbade61b Visit CreateView name as a relation (#2442)

This branch includes the following new commits:

     new cbade61b Visit CreateView name as a relation (#2442)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org


(datafusion-sqlparser-rs) 01/01: Visit CreateView name as a relation (#2442)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-2442-0821cbdd5cbdc27f9c7205466d357deef632c936
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git

commit cbade61b3f4c396d281ed7aa58801d0642c88fea
Author: sabir-akhadov-localstack <sa...@localstack.cloud>
AuthorDate: Thu Sep 3 16:13:40 2026 +0000

    Visit CreateView name as a relation (#2442)
    
    Co-authored-by: Claude Fable 5 <no...@anthropic.com>
---
 src/ast/ddl.rs     |  1 +
 src/ast/visitor.rs | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs
index c0b56ef8..66f2cad3 100644
--- a/src/ast/ddl.rs
+++ b/src/ast/ddl.rs
@@ -4386,6 +4386,7 @@ pub struct CreateView {
     /// <https://docs.snowflake.com/en/sql-reference/sql/create-view#syntax>
     pub secure: bool,
     /// View name
+    #[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
     pub name: ObjectName,
     /// If `if_not_exists` is true, this flag is set to true if the view name comes before the `IF NOT EXISTS` clause.
     /// Example:
diff --git a/src/ast/visitor.rs b/src/ast/visitor.rs
index 9011a94d..41b70320 100644
--- a/src/ast/visitor.rs
+++ b/src/ast/visitor.rs
@@ -1242,6 +1242,27 @@ mod tests {
         do_visit("SELECT a, b FROM t", &mut visitor);
         assert_eq!(visitor.idents, vec!["a", "b", "t"]);
     }
+
+    #[derive(Default)]
+    struct RelationVisitor {
+        relations: Vec<String>,
+    }
+
+    impl Visitor for RelationVisitor {
+        type Break = ();
+
+        fn pre_visit_relation(&mut self, relation: &ObjectName) -> ControlFlow<Self::Break> {
+            self.relations.push(relation.to_string());
+            ControlFlow::Continue(())
+        }
+    }
+
+    #[test]
+    fn test_visit_create_view_name_as_relation() {
+        let mut visitor = RelationVisitor::default();
+        do_visit("CREATE VIEW db1.v AS SELECT * FROM t", &mut visitor);
+        assert_eq!(visitor.relations, vec!["db1.v", "t"]);
+    }
 }
 
 #[cfg(test)]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org