From 82f411922d39cef3819a864d8cd334cb2812974f Mon Sep 17 00:00:00 2001 From: Gilles Darold Date: Fri, 31 Aug 2018 01:20:24 +0200 Subject: [PATCH] Fix case where an empty explain plan is generated. --- pgbadger | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pgbadger b/pgbadger index f1d9c2e..cc17395 100755 --- 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) { -- 2.40.0