File tree 3 files changed +22
-1
lines changed
tests/data/statements/valid
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -451,7 +451,11 @@ fn custom_handlers(node: &Node) -> TokenStream {
451
451
} ,
452
452
"CreateFunctionStmt" => quote ! {
453
453
tokens. push( TokenProperty :: from( Token :: Create ) ) ;
454
- tokens. push( TokenProperty :: from( Token :: Function ) ) ;
454
+ if n. is_procedure {
455
+ tokens. push( TokenProperty :: from( Token :: Procedure ) ) ;
456
+ } else {
457
+ tokens. push( TokenProperty :: from( Token :: Function ) ) ;
458
+ }
455
459
if n. replace {
456
460
tokens. push( TokenProperty :: from( Token :: Or ) ) ;
457
461
tokens. push( TokenProperty :: from( Token :: Replace ) ) ;
Original file line number Diff line number Diff line change @@ -224,4 +224,19 @@ mod tests {
224
224
] ,
225
225
)
226
226
}
227
+
228
+ #[ test]
229
+ fn test_create_procedure ( ) {
230
+ test_get_node_properties (
231
+ "create procedure insert_data(a integer)
232
+ language sql
233
+ as $$insert into tbl values (a);$$;" ,
234
+ SyntaxKind :: CreateFunctionStmt ,
235
+ vec ! [
236
+ TokenProperty :: from( SyntaxKind :: Create ) ,
237
+ TokenProperty :: from( SyntaxKind :: Procedure ) ,
238
+ TokenProperty :: from( "insert_data" . to_string( ) ) ,
239
+ ] ,
240
+ )
241
+ }
227
242
}
Original file line number Diff line number Diff line change
1
+ CREATE PROCEDURE insert_data(a integer , b integer ) LANGUAGE SQL AS $$INSERT INTO tbl VALUES (a); INSERT INTO tbl VALUES (b);$$;
2
+ CREATE PROCEDURE insert_data(a integer , b integer ) LANGUAGE SQL BEGIN ATOMIC INSERT INTO tbl VALUES (a); INSERT INTO tbl VALUES (b); END;
You can’t perform that action at this time.
0 commit comments