Skip to content

Commit

Permalink
Fix check_last_maintenance for version before 9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ioguix committed Jun 30, 2022
1 parent 97932c8 commit 7c19f0b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions check_pgactivity
Original file line number Diff line number Diff line change
Expand Up @@ -4842,9 +4842,11 @@ sub check_last_maintenance {
# from pg_stat_user_tables
$PG_VERSION_82 => qq{
SELECT coalesce(max(
extract(epoch FROM current_timestamp -
greatest(last_${type}, last_auto${type})
)), 'NaN'::float),
coalesce(extract(epoch FROM
current_timestamp -
greatest(last_${type}, last_auto${type})),
'infinity'::float)),
'NaN'::float),
NULL, NULL,
sum(hashtext(n_tup_ins::text
||n_tup_upd::text
Expand All @@ -4856,9 +4858,11 @@ sub check_last_maintenance {
# pg_stat_database
$PG_VERSION_83 => qq{
SELECT coalesce(max(
extract(epoch FROM current_timestamp -
greatest(last_${type}, last_auto${type})
)), 'NaN'::float),
coalesce(extract(epoch FROM
current_timestamp -
greatest(last_${type}, last_auto${type})),
'infinity'::float)),
'NaN'::float),
NULL, NULL,
(
SELECT md5(tup_inserted::text||tup_updated::text||tup_deleted::text)
Expand All @@ -4869,6 +4873,7 @@ sub check_last_maintenance {
WHERE schemaname NOT LIKE 'pg_temp_%'
AND schemaname NOT LIKE 'pg_toast_temp_%'
},
# Starting with 9.1, we can add the analyze/vacuum counts
$PG_VERSION_91 => qq{
SELECT coalesce(max(
coalesce(extract(epoch FROM
Expand Down

0 comments on commit 7c19f0b

Please sign in to comment.