diff --git a/check_postgres.pl b/check_postgres.pl index 928f39a..20550af 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -8666,6 +8666,7 @@ sub check_sequence { if($skipcycled) { $percsql = 'CASE WHEN cycle THEN 0 ELSE ' . $percsql . ' END'; } + my $version = verify_version(); my ($warning, $critical) = validate_range ({ @@ -8748,7 +8749,7 @@ sub check_sequence { my $multidb = @{$info->{db}} > 1 ? "$db->{dbname}." : ''; my @seq_sql; for my $r (@{$db->{slurp}}) { # for each sequence, create SQL command to inspect it - next if ($db->{version} >= 10); # TODO: skip loop entirely + next if ($version >= 10); # TODO: skip loop entirely my ($schema, $seq, $seqname, $typename) = @$r{qw/ nspname seqname safename typname /}; next if skip_item($seq); my $maxValue = $typename eq 'int2' ? $MAXINT2 : $typename eq 'int4' ? $MAXINT4 : $MAXINT8; @@ -8765,7 +8766,7 @@ sub check_sequence { FROM $seqname) foo }; } - if ($db->{version} >= 10) { + if ($version >= 10) { @seq_sql = ($SQL10); # inject PG10 query here (TODO: pull this out of loops) } # Use UNION ALL to query multiple sequences at once, however if there are too many sequences this can exceed