On Wed, Mar 03, 2021 at 01:17:57AM +0000, Tom Lane wrote:
> Extend the abilities of libpq's target_session_attrs parameter.
> 
> In addition to the existing options of "any" and "read-write", we
> now support "read-only", "primary", "standby", and "prefer-standby".
> "read-write" retains its previous meaning of "transactions are
> read-write by default", and "read-only" inverts that.  The other
> three modes test specifically for hot-standby status, which is not
> quite the same thing.  (Setting default_transaction_read_only on
> a primary server renders it read-only to this logic, but not a
> standby.)

pgperlcritic is complaining after this commit:
./src/test/recovery/t/001_stream_rep.pl: Variable declared in
conditional statement at line 88, column 2.  Declare variables outside
of the condition.  ([Variables::ProhibitConditionalDeclarations]
Severity: 5)

perlcritic is picky on this one, but you could just separate that
stuff into two lines like in the attached.
--
Michael
diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl
index 07a9912ce2..684bc8adbd 100644
--- a/src/test/recovery/t/001_stream_rep.pl
+++ b/src/test/recovery/t/001_stream_rep.pl
@@ -85,7 +85,8 @@ sub test_target_session_attrs
 	my $node2_port = $node2->port;
 	my $node2_name = $node2->name;
 
-	my $target_name = $target_node->name if (defined $target_node);
+	my $target_name = undef;
+	$target_name = $target_node->name if defined($target_node);
 
 	# Build connection string for connection attempt.
 	my $connstr = "host=$node1_host,$node2_host ";

Attachment: signature.asc
Description: PGP signature

Reply via email to