File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,11 @@ impl NodeEnum {
212212 iter. push ( ( rel. to_ref ( ) , depth, Context :: DML , false ) ) ;
213213 }
214214 }
215+ NodeRef :: CallStmt ( s) => {
216+ if let Some ( n) = s. funccall . as_ref ( ) {
217+ iter. push ( ( n. to_ref ( ) , depth, Context :: Call , false ) ) ;
218+ }
219+ }
215220 //
216221 // The following statement types are DDL (changing table structure)
217222 //
@@ -652,6 +657,12 @@ impl NodeEnum {
652657 iter. push ( ( rel. to_mut ( ) , depth, Context :: DML ) ) ;
653658 }
654659 }
660+ NodeMut :: CallStmt ( s) => {
661+ let s = s. as_mut ( ) . unwrap ( ) ;
662+ if let Some ( n) = s. funccall . as_mut ( ) {
663+ iter. push ( ( n. to_mut ( ) , depth, Context :: Call ) ) ;
664+ }
665+ }
655666 //
656667 // The following statement types are DDL (changing table structure)
657668 //
Original file line number Diff line number Diff line change @@ -1253,6 +1253,17 @@ fn it_finds_called_functions() {
12531253 assert_eq ! ( result. statement_types( ) , [ "SelectStmt" ] ) ;
12541254}
12551255
1256+ #[ test]
1257+ fn it_finds_functions_invoked_with_CALL ( ) {
1258+ let result = parse ( "CALL testfunc(1);" ) . unwrap ( ) ;
1259+ assert_eq ! ( result. warnings. len( ) , 0 ) ;
1260+ assert_eq ! ( result. tables( ) . len( ) , 0 ) ;
1261+ assert_eq ! ( result. functions( ) , [ "testfunc" ] ) ;
1262+ assert_eq ! ( result. ddl_functions( ) . len( ) , 0 ) ;
1263+ assert_eq ! ( result. call_functions( ) , [ "testfunc" ] ) ;
1264+ assert_eq ! ( result. statement_types( ) , [ "CallStmt" ] ) ;
1265+ }
1266+
12561267#[ test]
12571268fn it_finds_dropped_functions ( ) {
12581269 let result = parse ( "DROP FUNCTION IF EXISTS testfunc(x integer);" ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments