From 63a3c9bb65e6d0cc33ab33ec3b34f65b9bc5375e Mon Sep 17 00:00:00 2001 From: Darold Gilles Date: Wed, 6 Feb 2013 12:15:18 +0100 Subject: [PATCH] Fix display of empty table with --enable-log_min_duration on a file without statement. --- pgbadger | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pgbadger b/pgbadger index 1441dd9..779bfc7 100644 --- a/pgbadger +++ b/pgbadger @@ -1507,7 +1507,7 @@ Report not supported by text format }; } - if (!$disable_type && (!$log_duration || $enable_log_min_duration)) { + if (!$disable_type && $overall_stat{'queries_number'} && (!$log_duration || $enable_log_min_duration)) { # INSERT/DELETE/UPDATE/SELECT repartition my $totala = $overall_stat{'SELECT'} + $overall_stat{'INSERT'} + $overall_stat{'UPDATE'} + $overall_stat{'DELETE'}; @@ -2092,12 +2092,12 @@ EOF if (!$disable_hourly && ($overall_stat{'queries_number'} || exists $connection_info{chronos})) { print $fh qq{Hourly statistics | }; } - if (!$disable_type && (!$log_duration || $enable_log_min_duration)) { + if (!$disable_type && $overall_stat{'queries_number'} && (!$log_duration || $enable_log_min_duration)) { print $fh qq{Queries by type | }; print $fh qq{Queries per database | } if (scalar keys %database_info > 1); print $fh qq{Queries per application | } if (scalar keys %application_info > 1); } - if (!$disable_query && (!$log_duration || $enable_log_min_duration)) { + if (!$disable_query && $overall_stat{'queries_number'} && (!$log_duration || $enable_log_min_duration)) { print $fh qq{ Slowest queries | Queries that took up the most time (N) | @@ -2160,7 +2160,7 @@ sub html_footer if (!$disable_hourly && ($overall_stat{'queries_number'} || exists $connection_info{chronos})) { print $fh qq{
  • Hourly statistics
  • }; } - if (!$disable_type && (!$log_duration || $enable_log_min_duration)) { + if (!$disable_type && $overall_stat{'queries_number'} && (!$log_duration || $enable_log_min_duration)) { print $fh qq{
  • Queries by type
  • }; print $fh qq{
  • Queries per database
  • } if (scalar keys %database_info > 1); print $fh qq{
  • Queries per application
  • } if (scalar keys %application_info > 1); @@ -2656,7 +2656,7 @@ sub dump_as_html } } - if (!$disable_hourly) { + if (!$disable_hourly && (scalar keys %per_hour_info > 0)) { if ($tempfile_info{count} || exists $checkpoint_info{chronos} || exists $autovacuum_info{chronos} ) { print $fh qq{}; } @@ -2680,7 +2680,7 @@ sub dump_as_html if ($tempfile_info{count}) { print $fh qq{}; } - if (exists $checkpoint_info{chronos} && $checkpoint_info{wbuffer}) { + if ($checkpoint_info{wbuffer}) { print $fh qq{}; } @@ -2940,7 +2940,7 @@ sub dump_as_html } # INSERT/DELETE/UPDATE/SELECT repartition - if (!$disable_type && (!$log_duration || $enable_log_min_duration)) { + if (!$disable_type && $overall_stat{'queries_number'} && (!$log_duration || $enable_log_min_duration)) { print $fh qq{

    Queries by type ^

    DayHourCountAv. sizeWrote buffersAddedRemovedRecycledWrite time (sec)Sync time (sec)Total time (sec)
    @@ -3405,7 +3405,7 @@ sub dump_as_html } # Show top information - if (!$disable_query && (!$log_duration || $enable_log_min_duration)) { + if (!$disable_query && $overall_stat{'queries_number'} && (!$log_duration || $enable_log_min_duration)) { print $fh qq{

    Slowest queries ^

    -- 2.40.0