]> granicus.if.org Git - pgbadger/commitdiff
Fix multiline statement concatenation after an error.
authorGilles Darold <gilles.darold@dalibo.com>
Wed, 10 Aug 2016 16:44:53 +0000 (18:44 +0200)
committerGilles Darold <gilles.darold@dalibo.com>
Wed, 10 Aug 2016 16:45:31 +0000 (18:45 +0200)
Fix box size for report of queries generatin the most
temporary files and the most waiting queries.

pgbadger

index db6b8cf8e4f8b72c9e71fd18ea88c8c84021e971..2dacc51c2798b73e8967f85fee507aa3ecc997a8 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -3076,6 +3076,7 @@ sub parse_orphan_line
 
        # Otherwise append the orphan line to the corresponding part of the query
        } else {
+
                # Append to the error statement if one is defined
                if (exists $cur_info{$cur_pid}{statement}) {
                        $cur_info{$cur_pid}{statement} .= "\n" . $line if (!$nomultiline);
@@ -8918,7 +8919,7 @@ sub print_lock_queries_report
                        <td>$max_time</td>
                        <td>$avg_time</td>
                        <td id="queries-most-frequent-waiting-examples-details-rank-$rank">
-                               <div id="query-a-$rank" class="sql sql-largesize"><i class="icon-copy" title="Click to select query"></i>$query</div>$md5
+                               <div id="query-a-$rank" class="sql sql-middlesize"><i class="icon-copy" title="Click to select query"></i>$query</div>$md5
                                 $example
                        <!-- Examples collapse -->
                        <div id="queries-most-frequent-waiting-examples-rank-$rank" class="collapse">
@@ -9084,7 +9085,7 @@ sub print_tempfile_report
                                <td>$max_size</td>
                                <td>$avg_size</td>
                                <td id="queries-generating-most-temporary-files-examples-details-rank-$rank">
-                                       <div id="query-c-$rank" class="sql sql-largesize"><i class="icon-copy" title="Click to select query"></i>$query</div>$md5
+                                       <div id="query-c-$rank" class="sql sql-middlesize"><i class="icon-copy" title="Click to select query"></i>$query</div>$md5
                                        $example
                                <!-- Examples collapse -->
                                <div id="queries-generating-most-temporary-files-examples-rank-$rank" class="collapse">
@@ -12192,6 +12193,16 @@ sub parse_query
                }
        }
 
+       # Stores the error's detail if previous line was an error
+       if (($prefix_vars{'t_loglevel'} =~ /(DETAIL|STATEMENT|CONTEXT|HINT)/) && ($cur_info{$t_pid}{loglevel} =~ $main_error_regex)) {
+               if (($prefix_vars{'t_loglevel'} ne 'DETAIL') || ($prefix_vars{'t_query'} !~ /parameters: (.*)/)) {
+                       # Store error details only if this is not a parameter list (never present with errors)
+                       $cur_info{$t_pid}{"\L$prefix_vars{'t_loglevel'}\E"} .= $prefix_vars{'t_query'};
+               }
+               return;
+       }
+
+
        # Special cases when a STATEMENT is parsed
        if ($prefix_vars{'t_loglevel'} eq 'STATEMENT') {
                # Stores temporary file statement if a temporary record with the same pid exists
@@ -12224,15 +12235,6 @@ sub parse_query
                }
        }
 
-       # Stores the error's detail if previous line was an error
-       if (($prefix_vars{'t_loglevel'} =~ /(DETAIL|STATEMENT|CONTEXT|HINT)/) && ($cur_info{$t_pid}{loglevel} =~ $main_error_regex)) {
-               if (($prefix_vars{'t_loglevel'} ne 'DETAIL') || ($prefix_vars{'t_query'} !~ /parameters: (.*)/)) {
-                       # Store error details only if this is not a parameter list (never present with errors)
-                       $cur_info{$t_pid}{"\L$prefix_vars{'t_loglevel'}\E"} .= $prefix_vars{'t_query'};
-               }
-               return;
-       }
-
        # set current session workload
        if ( !$disable_session ) {
                my $sess_count = scalar keys %current_sessions;
@@ -13088,7 +13090,6 @@ sub store_queries
 
        # Store the collected information into global statistics
        if ($cur_info{$t_pid}{loglevel} =~ $main_error_regex) {
-
                # Add log level at beginning of the query and normalize it
                $cur_info{$t_pid}{query} = $cur_info{$t_pid}{loglevel} . ":  " . $cur_info{$t_pid}{query};
                my $normalized_error = &normalize_error($cur_info{$t_pid}{query});