summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael van Bracht2013-02-11 10:38:32 +0000
committerMichael van Bracht2013-02-11 10:38:32 +0000
commite9fcc600cd871e31f535f2699706e534c22a3f6b (patch)
treeb5548fc45f7d5aeb1f0562557a3ad28645e1e7f8
parent4261802d4b29468de01ba0bfb4ae78ef35c3c457 (diff)
Fix userclause handling in check_txn_idle
For databases > Postgrs 9.1, irrelevant records are discarded with two ORed conditions. This makes the optional userclause associate with the right hand side of the condition. The expression needs to be grouped to get the desired effect regardless of the evaluation of the previous condition.
-rwxr-xr-xcheck_postgres.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index e3b3a0cd0..f6730f2cb 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -7550,8 +7550,8 @@ sub check_txn_idle {
## Craft an alternate version for new servers which do not have procpid and current_query is split
($SQL3 = $SQL) =~ s/procpid/pid/g;
- $SQL3 =~ s/current_query ~ '\^<'/state = 'idle in transaction' OR state IS NULL/;
- $SQL3 =~ s/current_query NOT LIKE '<IDLE>%'/state NOT LIKE 'idle%' OR state IS NULL/; # query_time
+ $SQL3 =~ s/current_query ~ '\^<'/(state = 'idle in transaction' OR state IS NULL)/;
+ $SQL3 =~ s/current_query NOT LIKE '<IDLE>%'/(state NOT LIKE 'idle%' OR state IS NULL)/; # query_time
$SQL3 =~ s/current_query/query/g;
$SQL3 =~ s/'' AS state/state AS state/;