From 695da731af1ce6965c4a45063936b37a307385ac Mon Sep 17 00:00:00 2001 From: Adrien Nayrat Date: Wed, 15 May 2024 16:31:21 +0200 Subject: [PATCH] Ignore partition table in check_last_maintenance Partitioned tables are empty, thus last_* are null. Fix https://github.com/OPMDG/check_pgactivity/issues/365 --- check_pgactivity | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check_pgactivity b/check_pgactivity index 3cb42bb4..1f4b6a69 100755 --- a/check_pgactivity +++ b/check_pgactivity @@ -5053,9 +5053,12 @@ sub check_last_maintenance { FROM pg_catalog.pg_stat_database WHERE datname = current_database() ) - FROM pg_stat_user_tables + FROM pg_stat_user_tables a + JOIN pg_class b on a.relid = b.oid WHERE schemaname NOT LIKE 'pg_temp_%' AND schemaname NOT LIKE 'pg_toast_temp_%' + AND (('${type}' = 'vacuum' AND relkind <> 'p') -- partitioned table do not have last_* information + OR ('${type}' = 'analyze')) } );