summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg Sabino Mullane2011-05-31 14:16:39 +0000
committerGreg Sabino Mullane2011-05-31 14:16:39 +0000
commit0e5a87dafcaec05164bc505e0b9955e7a22a602a (patch)
tree0bdfd71d9d1be6cf6d13ed8d517800d6215ad600 /check_postgres.pl
parent3f6c95413413bf2b45019f7bf8c1670b3e48f628 (diff)
On a parsing problem, output the Postgres version as well.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl18
1 files changed, 13 insertions, 5 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 437d4000a..27e327d28 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -2199,11 +2199,19 @@ sub run_command {
warn "$msg\n";
my $cline = (caller)[2];
my $args = join ' ' => @args;
- warn "Version: $VERSION\n";
- warn "Action: $action\n";
- warn "Calling line: $cline\n";
- warn "Output: $line\n";
- warn "Command: $PSQL $args\n";
+ warn "Version: $VERSION\n";
+ warn "Action: $action\n";
+ warn "Calling line: $cline\n";
+ warn "Output: $line\n";
+ warn "Command: $PSQL $args\n";
+ ## Last thing is to see if we can grab the PG version
+ if (! $opt{stop_looping}) {
+ ## Just in case...
+ $opt{stop_looping} = 1;
+ my $info = run_command('SELECT version() AS version');
+ (my $v = $info->{db}[0]{slurp}[0]{version}) =~ s/(\w+ \S+).+/$1/;
+ warn "Postgres version: $v\n";
+ }
exit 1;
}
}