@@ -36,19 +36,19 @@ use sqlparser_derive::{Visit, VisitMut};
3636
3737use crate :: ast:: value:: escape_single_quote_string;
3838use crate :: ast:: {
39- display_comma_separated, display_separated,
39+ display_comma_separated, display_separated, format_statement_list ,
4040 table_constraints:: {
4141 CheckConstraint , ForeignKeyConstraint , PrimaryKeyConstraint , TableConstraint ,
4242 UniqueConstraint ,
4343 } ,
44- ArgMode , AttachedToken , CommentDef , ConditionalStatements , CreateFunctionBody ,
45- CreateFunctionUsing , CreateServerOption , CreateTableLikeKind , CreateTableOptions ,
46- CreateViewParams , DataType , Expr , FileFormat , FunctionBehavior , FunctionCalledOnNull ,
47- FunctionDefinitionSetParam , FunctionDesc , FunctionDeterminismSpecifier , FunctionParallel ,
48- FunctionSecurity , HiveDistributionStyle , HiveFormat , HiveIOFormat , HiveRowFormat ,
49- HiveSetLocation , Ident , InitializeKind , MySQLColumnPosition , ObjectName , OnCommit ,
50- OneOrManyWithParens , OperateFunctionArg , OrderByExpr , ProjectionSelect , Query , RefreshModeKind ,
51- ResetConfig , RowAccessPolicy , SequenceOptions , Spanned , SqlOption , Statement ,
44+ ArgMode , AttachedToken , BeginEndStatements , CommentDef , ConditionalStatements ,
45+ CreateFunctionBody , CreateFunctionUsing , CreateServerOption , CreateTableLikeKind ,
46+ CreateTableOptions , CreateViewParams , DataType , Expr , FileFormat , FunctionBehavior ,
47+ FunctionCalledOnNull , FunctionDefinitionSetParam , FunctionDesc , FunctionDeterminismSpecifier ,
48+ FunctionParallel , FunctionSecurity , HiveDistributionStyle , HiveFormat , HiveIOFormat ,
49+ HiveRowFormat , HiveSetLocation , Ident , InitializeKind , MySQLColumnPosition , ObjectName ,
50+ OnCommit , OneOrManyWithParens , OperateFunctionArg , OrderByExpr , ProjectionSelect , Query ,
51+ RefreshModeKind , ResetConfig , RowAccessPolicy , SequenceOptions , Spanned , SqlOption , Statement ,
5252 StorageLifecyclePolicy , StorageSerializationPolicy , TableVersion , Tag , TriggerEvent ,
5353 TriggerExecBody , TriggerObject , TriggerPeriod , TriggerReferencing , Value , ValueWithSpan ,
5454 WrappedCollection ,
@@ -3882,6 +3882,16 @@ impl fmt::Display for CreateFunction {
38823882 if let Some ( CreateFunctionBody :: Return ( function_body) ) = & self . function_body {
38833883 write ! ( f, " RETURN {function_body}" ) ?;
38843884 }
3885+ if let Some ( CreateFunctionBody :: BeginAtomic ( BeginEndStatements { statements, .. } ) ) =
3886+ & self . function_body
3887+ {
3888+ write ! ( f, " BEGIN ATOMIC" ) ?;
3889+ if !statements. is_empty ( ) {
3890+ write ! ( f, " " ) ?;
3891+ format_statement_list ( f, statements) ?;
3892+ }
3893+ write ! ( f, " END" ) ?;
3894+ }
38853895 if let Some ( CreateFunctionBody :: AsReturnExpr ( function_body) ) = & self . function_body {
38863896 write ! ( f, " AS RETURN {function_body}" ) ?;
38873897 }
0 commit comments