]> granicus.if.org Git - pgbadger/commitdiff
Fix case where an empty explain plan is generated.
authorGilles Darold <gilles@darold.net>
Thu, 30 Aug 2018 23:20:24 +0000 (01:20 +0200)
committerGilles Darold <gilles@darold.net>
Thu, 30 Aug 2018 23:20:24 +0000 (01:20 +0200)
pgbadger

index f1d9c2edea020adb851169e03a59721abf3e7ea4..cc17395f2dfcf556edda4a2b4dab01d321672378 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -3336,7 +3336,7 @@ sub parse_orphan_line
 
                $cur_info{$cur_pid}{parameters} .= " $line" if (!$error_only);
 
-       } elsif (exists $cur_plan_info{$cur_pid}) {
+       } elsif (exists $cur_plan_info{$cur_pid}{plan}) {
 
                $cur_plan_info{$cur_pid}{plan} .= "\n" . $line;
 
@@ -13337,6 +13337,7 @@ sub parse_query
        # Activate storage of the explain plan generated by auto_explain
        } elsif ($prefix_vars{'t_query'} =~ s/duration: ([0-9\.]+) ms\s+plan://s) {
                $cur_plan_info{$prefix_vars{'t_pid'}}{duration} = $1;
+               $cur_plan_info{$prefix_vars{'t_pid'}}{plan} = '';
                $prefix_vars{'t_duration'} = $1; # needed to be saved later
        # Log line without duration at all
        } elsif ($prefix_vars{'t_query'} =~ s/(query|statement): //is) {