From: madtibo Date: Wed, 23 Jan 2019 13:34:49 +0000 (+0100) Subject: truncate statement when maxlength is used X-Git-Tag: v10.3~7^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=850cbf9fc219cbdf665285fac5d9c8a00f492e85;p=pgbadger truncate statement when maxlength is used --- diff --git a/pgbadger b/pgbadger index dbc0330..7ebd36c 100755 --- a/pgbadger +++ b/pgbadger @@ -13989,6 +13989,13 @@ sub store_queries } + # We only process stored object with query here + if ($cur_info{$t_pid}{statement}) { + # Truncate the statement if requested by the user + $cur_info{$t_pid}{statement} = substr($cur_info{$t_pid}{statement}, 0, $maxlength) . '[...]' + if (($maxlength > 0) && (length($cur_info{$t_pid}{statement}) > $maxlength)); + } + my $cur_day_str = "$cur_info{$t_pid}{year}$cur_info{$t_pid}{month}$cur_info{$t_pid}{day}"; my $cur_hour_str = "$cur_info{$t_pid}{hour}";