diff --git a/lib/pgFormatter/Beautify.pm b/lib/pgFormatter/Beautify.pm index 123c635..69d9c04 100755 --- a/lib/pgFormatter/Beautify.pm +++ b/lib/pgFormatter/Beautify.pm @@ -648,6 +648,13 @@ sub tokenize_sql if ($self->{ 'keep_newline' }) { @query = grep { /(?:\S|^[\r\n]+$)/ } $query =~ m{$re}simxg; } + # fix := operator that can not be found when attached to the variable name + for (my $i = 0; $i < $#query; $i++) { + if ($query[$i] =~ /:$/ && $query[$i+1] =~ /^=/) { + $query[$i] =~ s/:$//; + $query[$i+1] =~ s/^/:/; + } + } # Revert position when a comment is before a comma if ($self->{ 'comma' } eq 'end') diff --git a/t/test-files/ex64.sql b/t/test-files/ex64.sql index 3d88235..0a2004a 100644 --- a/t/test-files/ex64.sql +++ b/t/test-files/ex64.sql @@ -12,7 +12,7 @@ DECLARE a_val partitioned_table.a%TYPE; result partitioned_table%ROWTYPE; BEGIN - a_val := $1; + a_val:= $1; SELECT * INTO result FROM partitioned_table WHERE a = a_val;