@@ -160,7 +160,7 @@ Takes options as hash. Following options are recognized:
160160
161161=item * no_extra_line - do not add an extra empty line at end of the output
162162
163- =item * keep_newline - preserve empty line in plpgsql code
163+ =item * keep_newline - preserve empty line in plpgsql code
164164
165165=item * no_space_function - remove space before function call and open parenthesis
166166
@@ -2475,7 +2475,7 @@ sub beautify {
24752475 $add_newline
24762476 and $self -> {' comma' } eq ' end'
24772477 and ( $self -> {' comma_break' }
2478- || ($self -> {' _current_sql_stmt' } ne ' INSERT'
2478+ || ($self -> {' _current_sql_stmt' } ne ' INSERT'
24792479 && ($self -> {' _current_sql_stmt' } ne ' DO UPDATE'
24802480 || !$self -> {' _parenthesis_level' })) )
24812481 )
@@ -2490,10 +2490,12 @@ sub beautify {
24902490
24912491 $self -> _add_token($token );
24922492
2493- next
2494- if ( $token eq ' ;'
2493+ if ( $token eq ' ;'
24952494 and $# { $self -> {' _is_in_case' } } >= 0
2496- and uc ($last ) ne ' CASE' );
2495+ and uc ($last ) ne ' CASE' ) {
2496+ $last = $self -> _set_last( $token , $last );
2497+ next ;
2498+ }
24972499
24982500 if ( $self -> {' _is_in_type' } and $last eq ' )' ) {
24992501 $self -> _reset_level( $token , $last )
@@ -3683,6 +3685,10 @@ sub beautify {
36833685 $self -> {' content' } =~ s /\s +$/ \n / s ;
36843686 }
36853687
3688+ if ($# { $self -> {' _is_in_case' } } >= 0 && defined $last && $last eq ' ;' ) {
3689+ $self -> _new_line( $token , $last );
3690+ }
3691+
36863692 # Finally add the token without further condition
36873693 $self -> _add_token( $token , $last );
36883694
@@ -3948,7 +3954,7 @@ sub _add_token {
39483954 if ($DEBUG_SP );
39493955 $self -> {' content' } .= $sp ;
39503956 }
3951- else {
3957+ else {
39523958 print STDERR " DEBUG_SPC: 7) last=" , ( $last_token || ' ' ),
39533959 " , token=$token \n "
39543960 if ($DEBUG_SP );
0 commit comments