@@ -99,7 +99,7 @@ impl Visitor for V {
9999 Statement :: Insert ( i) => {
100100 self . query_type = QueryType :: INSERT ;
101101 // The "insert" statement has a table as a target
102- let table_name = i. table_name . to_string ( ) ;
102+ let table_name = i. table . to_string ( ) ;
103103 self . tables . insert ( table_name. clone ( ) ) ;
104104 self . target_table = table_name. clone ( ) ;
105105 for i in & i. columns {
@@ -113,6 +113,7 @@ impl Visitor for V {
113113 from : _,
114114 selection : _,
115115 returning : _,
116+ or : _,
116117 } => {
117118 self . query_type = QueryType :: UPDATE ;
118119 // The "insert" statement has a table as a target
@@ -142,7 +143,16 @@ impl Visitor for V {
142143 let full_name = format ! ( "{table_name}.{column}" ) ;
143144 self . columns . insert ( full_name) ;
144145 } else {
145- let full_name = join ( & ident. 0 ) ;
146+ // Convert ObjectNameParts to Idents for join function
147+ let idents: Vec < Ident > = ident
148+ . 0
149+ . iter ( )
150+ . filter_map ( |part| match part {
151+ ObjectNamePart :: Identifier ( ident) => Some ( ident. clone ( ) ) ,
152+ ObjectNamePart :: Function ( _) => None ,
153+ } )
154+ . collect ( ) ;
155+ let full_name = join ( & idents) ;
146156 self . columns . insert ( full_name) ;
147157 }
148158 }
@@ -180,13 +190,15 @@ impl Visitor for V {
180190
181191 fn pre_visit_relation ( & mut self , relation : & ObjectName ) -> ControlFlow < Self :: Break > {
182192 // Relation === table name
183- let table_name = relation. 0 [ 0 ] . value . clone ( ) ;
184- self . tables . insert ( table_name. clone ( ) ) ;
193+ if let Some ( ObjectNamePart :: Identifier ( ident) ) = relation. 0 . first ( ) {
194+ let table_name = ident. value . clone ( ) ;
195+ self . tables . insert ( table_name) ;
196+ }
185197 ControlFlow :: Continue ( ( ) )
186198 }
187199
188200 fn pre_visit_expr ( & mut self , expr : & Expr ) -> ControlFlow < Self :: Break > {
189- if let Expr :: Wildcard = expr {
201+ if let Expr :: Wildcard ( _ ) = expr {
190202 self . columns . insert ( "*" . to_string ( ) ) ;
191203 }
192204 if let Expr :: Identifier ( ident) = expr {
0 commit comments