Cleanup perl code from unused variables and routines
authorMichael Paquier <[email protected]>
Tue, 2 Jul 2024 00:47:16 +0000 (09:47 +0900)
committerMichael Paquier <[email protected]>
Tue, 2 Jul 2024 00:47:16 +0000 (09:47 +0900)
This commit removes unused variables and routines from some perl code
that have accumulated across the years.  This touches the following
areas:
- Wait event generation script.
- AdjustUpgrade.pm.
- TAP perl code

Author: Alexander Lakhin
Reviewed-by: Dagfinn Ilmari Mannsåker
Discussion: https://postgr.es/m/70b340bc-244a-589d-ef8b-d8aebb707a84@gmail.com

contrib/amcheck/t/001_verify_heapam.pl
contrib/amcheck/t/002_cic.pl
src/backend/utils/activity/generate-wait_event_types.pl
src/bin/pg_dump/t/003_pg_dump_with_server.pl
src/bin/pg_dump/t/005_pg_dump_filterfile.pl
src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
src/test/recovery/t/021_row_visibility.pl
src/test/recovery/t/032_relfilenode_reuse.pl
src/test/recovery/t/035_standby_logical_decoding.pl

index 9de3148277f1d945c964518f6051d8bc0f6cb3e9..481e4dbe4feae85c0667df1d3d10e631dfa0bf3d 100644 (file)
@@ -9,7 +9,7 @@ use PostgreSQL::Test::Utils;
 
 use Test::More;
 
-my ($node, $result);
+my $node;
 
 #
 # Test set-up
@@ -87,19 +87,6 @@ sub relation_filepath
    return "$pgdata/$rel";
 }
 
-# Returns the fully qualified name of the toast table for the named relation
-sub get_toast_for
-{
-   my ($relname) = @_;
-
-   return $node->safe_psql(
-       'postgres', qq(
-       SELECT 'pg_toast.' || t.relname
-           FROM pg_catalog.pg_class c, pg_catalog.pg_class t
-           WHERE c.relname = '$relname'
-             AND c.reltoastrelid = t.oid));
-}
-
 # (Re)create and populate a test table of the given name.
 sub fresh_test_table
 {
index 53a3db9745f4061d09e81ea554c707a858db7eba..0207407ca0e9682cb771805b89fbbb7f6a649574 100644 (file)
@@ -10,7 +10,7 @@ use PostgreSQL::Test::Utils;
 
 use Test::More;
 
-my ($node, $result);
+my $node;
 
 #
 # Test set-up
index 6a9c0a5d347113c16a2782058d1c615e07c8ebb5..2f2fa5bb8f418ff14b8bf8aa72dcd6e7de722e50 100644 (file)
@@ -42,8 +42,6 @@ my @abi_compatibility_lines;
 my @lines;
 my $abi_compatibility = 0;
 my $section_name;
-my $note;
-my $note_name;
 
 # Remove comments and empty lines and add waitclassname based on the section
 while (<$wait_event_names>)
index b5a144555074db3c7686610da2868a4a2e033715..3f549f44e75980cf19204a1e5b2d874851e0475a 100644 (file)
@@ -26,7 +26,6 @@ $node->safe_psql('postgres', "CREATE SERVER s1 FOREIGN DATA WRAPPER dummy");
 $node->safe_psql('postgres', "CREATE SERVER s2 FOREIGN DATA WRAPPER dummy");
 $node->safe_psql('postgres', "CREATE FOREIGN TABLE t0 (a int) SERVER s0");
 $node->safe_psql('postgres', "CREATE FOREIGN TABLE t1 (a int) SERVER s1");
-my ($cmd, $stdout, $stderr, $result);
 
 command_fails_like(
    [ "pg_dump", '-p', $port, '--include-foreign-data=s0', 'postgres' ],
index a80e13a0d36f54d1c9d5441acc7a00fc421b6a44..6025bb296cc40a2c4286ae3ee20b4cd41aaddd84 100644 (file)
@@ -81,7 +81,6 @@ $node->safe_psql('sourcedb',
 #
 # Test interaction of correctly specified filter file
 #
-my ($cmd, $stdout, $stderr, $result);
 
 # Empty filterfile
 open $inputfile, '>', "$tempdir/inputfile.txt"
index b990e7d101ea2e77264f090d30995d549c87ca92..82b1cb88e9f068d35101efb8601526d7fc29d97f 100644 (file)
@@ -12,10 +12,6 @@ use Test::More;
 use lib "$FindBin::RealBin/../../../ldap";
 use LdapServer;
 
-my ($slapd, $ldap_bin_dir, $ldap_schema_dir);
-
-$ldap_bin_dir = undef;    # usually in PATH
-
 if ($ENV{with_ldap} ne 'yes')
 {
    plan skip_all => 'LDAP not supported by this build';
index 7a63539f39c48448ed394e4630151618b7e149dc..f71d0ff3e05ae5eea201016a39f57bf35db33ab6 100644 (file)
@@ -15,7 +15,6 @@ unless (($ENV{with_ssl} || "") eq 'openssl')
    plan skip_all => 'OpenSSL not supported by this build';
 }
 
-my $clearpass = "FooBaR1";
 my $rot13pass = "SbbOnE1";
 
 # see the Makefile for how the certificate and key have been generated
index 3cec72d9d4ff2bfd5ad6a9eb5866af2c4f11535c..239c17aced9534a2567f6e6ed48feaca68c5b669 100644 (file)
@@ -534,7 +534,6 @@ sub _mash_view_qualifiers
        {
            my @thischunks = split /;/, $chunk, 2;
            my $stmt = shift(@thischunks);
-           my $ostmt = $stmt;
 
            # now $stmt is just the body of the CREATE [MATERIALIZED] VIEW
            $stmt =~ s/$qualifier\.//g;
index 255caffb19dbc1a707b526ae58d7b14b98cdda6e..d0461376014fef9e233db11277db8398dfc708eb 100644 (file)
@@ -168,7 +168,6 @@ $node_standby->stop;
 sub send_query_and_wait
 {
    my ($psql, $query, $untl) = @_;
-   my $ret;
 
    # send query
    $$psql{stdin} .= $query;
index 96a8104b802674ff509a19bf551924a0885ead56..d473cd167c13289a5aeb43017f4dab3075489f5d 100644 (file)
@@ -205,7 +205,6 @@ sub cause_eviction
 sub send_query_and_wait
 {
    my ($psql, $query, $untl) = @_;
-   my $ret;
 
    # For each query we run, we'll restart the timeout.  Otherwise the timeout
    # would apply to the whole test script, and would need to be set very high
index 4628f9fb80635b99e088b11bf1df32fd416b2c20..4185b803b2582793a45433b88af231c8a8f2d4ee 100644 (file)
@@ -10,10 +10,7 @@ use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
 
-my ($stdin, $stdout, $stderr,
-   $cascading_stdout, $cascading_stderr, $subscriber_stdin,
-   $subscriber_stdout, $subscriber_stderr, $ret,
-   $handle, $slot);
+my ($stdout, $stderr, $cascading_stdout, $cascading_stderr, $handle);
 
 my $node_primary = PostgreSQL::Test::Cluster->new('primary');
 my $node_standby = PostgreSQL::Test::Cluster->new('standby');