From: glynastill Date: Thu, 16 Apr 2015 16:24:10 +0000 (+0100) Subject: Fix "values are not the same" error in replicate_row when repinfo value is a '0' X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=172c6c539896799ce597ea75250264d7f271b00f;p=check_postgres.git Fix "values are not the same" error in replicate_row when repinfo value is a '0' When check_replicate_row tested for valid values before starting the check, if the actual value returned was 0 it would evaluate to false, resulting in the error: "Cannot test replication: values are not the same" This is resolved by simply checking if the value is defined before assigning it's value a blank string instead. --- diff --git a/check_postgres.pl b/check_postgres.pl index 77d532681..61a1d883d 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -6442,11 +6442,11 @@ sub check_replicate_row { if (!defined $sourcedb) { ndie msg('rep-norow', "$table.$col"); } - my $value1 = $info1->{db}[0]{slurp}[0]{c} || ''; + my $value1 = (defined($info1->{db}[0]{slurp}[0]{c})?$info1->{db}[0]{slurp}[0]{c}:''); my $numslaves = @{$info1->{db}} - 1; for my $d ( @{$info1->{db}}[1 .. $numslaves] ) { - my $value2 = $d->{slurp}[0]{c} || ''; + my $value2 = (defined($d->{slurp}[0]{c})?$d->{slurp}[0]{c}:''); if ($value1 ne $value2) { ndie msg('rep-notsame'); }