]> granicus.if.org Git - pgbadger/commitdiff
Fix incorrect numbers on positional parameters in queries-generating-most-temporary...
authorDarold Gilles <gilles@darold.net>
Sat, 6 Feb 2016 09:56:21 +0000 (10:56 +0100)
committerDarold Gilles <gilles@darold.net>
Sat, 6 Feb 2016 09:56:21 +0000 (10:56 +0100)
pgbadger

index b2d924e360865862e09e0a0bb0a9c2997b948c52..383af4328b176f346c3f06f93577624cfe6549c9 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -3117,24 +3117,24 @@ sub normalize_query
        $orig_query =~ s/AS\s+"([^"]+)"/'AS "' . remove_alias($1) . '"'/eigs;
        
        # Remove string content
-       $orig_query =~ s/\\'//g;
-       $orig_query =~ s/'[^']*'/''/g;
-       $orig_query =~ s/''('')+/''/g;
+       $orig_query =~ s/\\'//gs;
+       $orig_query =~ s/'[^']*'/''/gs;
+       $orig_query =~ s/''('')+/''/gs;
 
        # Remove NULL parameters
-       $orig_query =~ s/=\s*NULL/=''/g;
+       $orig_query =~ s/=\s*NULL/=''/gs;
 
        # Remove numbers
-       $orig_query =~ s/([^a-z_\$-])-?([0-9]+)/${1}0/g;
+       $orig_query =~ s/([^a-z0-9_\$\-])-?\d+/${1}0/gs;
 
        # Remove hexadecimal numbers
-       $orig_query =~ s/([^a-z_\$-])0x[0-9a-f]{1,10}/${1}0x/g;
+       $orig_query =~ s/([^a-z_\$-])0x[0-9a-f]{1,10}/${1}0x/gs;
 
        # Remove IN values
-       $orig_query =~ s/\bin\s*\([\'0x,\s]*\)/in (...)/g;
+       $orig_query =~ s/\bin\s*\([\'0x,\s]*\)/in (...)/gs;
 
        # Remove curor names in CURSOR and IN clauses
-       $orig_query =~ s/\b(declare|in)\s+"[^"]+"/$1 "..."/g;
+       $orig_query =~ s/\b(declare|in)\s+"[^"]+"/$1 "..."/gs;
 
        return $orig_query;
 }