*/
 
 /* where the digit set begins, and how many of them are in the table */
-const unsigned EAN13_index[10][2] = {
+static const unsigned EAN13_index[10][2] = {
        {0, 6},
        {6, 1},
        {7, 1},
        {90, 17},
        {107, 12},
 };
-const char *EAN13_range[][2] = {
+static const char *EAN13_range[][2] = {
        {"000", "019"},                         /* GS1 US */
        {"020", "029"},                         /* Restricted distribution (MO defined) */
        {"030", "039"},                         /* GS1 US */
 
  */
 
 /* where the digit set begins, and how many of them are in the table */
-const unsigned ISBN_index[10][2] = {
+static const unsigned ISBN_index[10][2] = {
        {0, 6},
        {6, 6},
        {12, 8},
        {192, 718},
 };
 
-const char *ISBN_range[][2] = {
+static const char *ISBN_range[][2] = {
        {"0-00", "0-19"},
        {"0-200", "0-699"},
        {"0-7000", "0-8499"},
  */
 
 /* where the digit set begins, and how many of them are in the table */
-const unsigned ISBN_index_new[10][2] = {
+static const unsigned ISBN_index_new[10][2] = {
        {0, 0},
        {0, 5},
        {5, 0},
        {5, 0},
 };
 
-const char *ISBN_range_new[][2] = {
+static const char *ISBN_range_new[][2] = {
        {"10-00", "10-19"},
        {"10-200", "10-699"},
        {"10-7000", "10-8999"},
 
  */
 
 /* where the digit set begins, and how many of them are in the table */
-const unsigned ISMN_index[10][2] = {
+static const unsigned ISMN_index[10][2] = {
        {0, 5},
        {5, 0},
        {5, 0},
        {5, 0},
        {5, 0},
 };
-const char *ISMN_range[][2] = {
+static const char *ISMN_range[][2] = {
        {"0-000", "0-099"},
        {"0-1000", "0-3999"},
        {"0-40000", "0-69999"},
 
  */
 
 /* where the digit set begins, and how many of them are in the table */
-const unsigned ISSN_index[10][2] = {
+static const unsigned ISSN_index[10][2] = {
        {0, 1},
        {0, 1},
        {0, 1},
        {0, 1},
        {0, 1},
 };
-const char *ISSN_range[][2] = {
+static const char *ISSN_range[][2] = {
        {"0000-000", "9999-999"},
        {NULL, NULL}
 };
 
  */
 
 /* where the digit set begins, and how many of them are in the table */
-const unsigned UPC_index[10][2] = {
+static const unsigned UPC_index[10][2] = {
        {0, 0},
        {0, 0},
        {0, 0},
        {0, 0},
        {0, 0},
 };
-const char *UPC_range[][2] = {
+static const char *UPC_range[][2] = {
        {NULL, NULL}
 };
 
 /* GUC parameters */
 int                    Password_encryption = PASSWORD_TYPE_SCRAM_SHA_256;
 char      *createrole_self_grant = "";
-bool           createrole_self_grant_enabled = false;
-GrantRoleOptions createrole_self_grant_options;
+static bool createrole_self_grant_enabled = false;
+static GrantRoleOptions createrole_self_grant_options;
 
 /* Hook to check passwords in CreateRole() and AlterRole() */
 check_password_hook_type check_password_hook = NULL;
 
        bool            shmem_attach;
 } child_process_kind;
 
-child_process_kind child_process_kinds[] = {
+static child_process_kind child_process_kinds[] = {
        [B_INVALID] = {"invalid", NULL, false},
 
        [B_BACKEND] = {"backend", BackendMain, true},
 
        slock_t         mutex;
 } SlotSyncCtxStruct;
 
-SlotSyncCtxStruct *SlotSyncCtx = NULL;
+static SlotSyncCtxStruct *SlotSyncCtx = NULL;
 
 /* GUC variable */
 bool           sync_replication_slots = false;
 
 } TransApplyAction;
 
 /* errcontext tracker */
-ApplyErrorCallbackArg apply_error_callback_arg =
+static ApplyErrorCallbackArg apply_error_callback_arg =
 {
        .command = 0,
        .rel = NULL,
 
  * This GUC exists solely for backward compatibility, check its definition for
  * details.
  */
-bool           default_with_oids = false;
+static bool default_with_oids = false;
+
 bool           current_role_is_superuser;
 
 int                    log_min_error_statement = ERROR;
  * This avoids breaking compatibility with clients that have never supported
  * renegotiation and therefore always try to zero it.
  */
-int                    ssl_renegotiation_limit;
+static int     ssl_renegotiation_limit;
 
 /*
  * This really belongs in pg_shmem.c, but is defined here so that it doesn't
  */
 int                    huge_pages = HUGE_PAGES_TRY;
 int                    huge_page_size;
-int                    huge_pages_status = HUGE_PAGES_UNKNOWN;
+static int     huge_pages_status = HUGE_PAGES_UNKNOWN;
 
 /*
  * These variables are all dummies that don't do anything, except in some
 
 #include "common/logging.h"
 #include "getopt_long.h"
 
-const char *progname;
+static const char *progname;
 
 /* Options and defaults */
-bool           dryrun = false;         /* are we performing a dry-run operation? */
-bool           cleanBackupHistory = false; /* remove files including backup
+static bool dryrun = false;            /* are we performing a dry-run operation? */
+static bool cleanBackupHistory = false; /* remove files including backup
                                                                                 * history files */
-char      *additional_ext = NULL;      /* Extension to remove from filenames */
+static char *additional_ext = NULL; /* Extension to remove from filenames */
 
-char      *archiveLocation;    /* where to find the archive? */
-char      *restartWALFileName; /* the file from which we can restart restore */
-char           exclusiveCleanupFileName[MAXFNAMELEN];  /* the oldest file we want
+static char *archiveLocation;  /* where to find the archive? */
+static char *restartWALFileName;       /* the file from which we can restart
+                                                                        * restore */
+static char exclusiveCleanupFileName[MAXFNAMELEN];     /* the oldest file we want
                                                                                                         * to remain in archive */
 
 
 
 static void bbstreamer_plain_writer_finalize(bbstreamer *streamer);
 static void bbstreamer_plain_writer_free(bbstreamer *streamer);
 
-const bbstreamer_ops bbstreamer_plain_writer_ops = {
+static const bbstreamer_ops bbstreamer_plain_writer_ops = {
        .content = bbstreamer_plain_writer_content,
        .finalize = bbstreamer_plain_writer_finalize,
        .free = bbstreamer_plain_writer_free
 static void extract_link(const char *filename, const char *linktarget);
 static FILE *create_file_for_extract(const char *filename, mode_t mode);
 
-const bbstreamer_ops bbstreamer_extractor_ops = {
+static const bbstreamer_ops bbstreamer_extractor_ops = {
        .content = bbstreamer_extractor_content,
        .finalize = bbstreamer_extractor_finalize,
        .free = bbstreamer_extractor_free
 
 static void bbstreamer_gzip_writer_free(bbstreamer *streamer);
 static const char *get_gz_error(gzFile gzf);
 
-const bbstreamer_ops bbstreamer_gzip_writer_ops = {
+static const bbstreamer_ops bbstreamer_gzip_writer_ops = {
        .content = bbstreamer_gzip_writer_content,
        .finalize = bbstreamer_gzip_writer_finalize,
        .free = bbstreamer_gzip_writer_free
 static void *gzip_palloc(void *opaque, unsigned items, unsigned size);
 static void gzip_pfree(void *opaque, void *address);
 
-const bbstreamer_ops bbstreamer_gzip_decompressor_ops = {
+static const bbstreamer_ops bbstreamer_gzip_decompressor_ops = {
        .content = bbstreamer_gzip_decompressor_content,
        .finalize = bbstreamer_gzip_decompressor_finalize,
        .free = bbstreamer_gzip_decompressor_free
 
 static void bbstreamer_recovery_injector_finalize(bbstreamer *streamer);
 static void bbstreamer_recovery_injector_free(bbstreamer *streamer);
 
-const bbstreamer_ops bbstreamer_recovery_injector_ops = {
+static const bbstreamer_ops bbstreamer_recovery_injector_ops = {
        .content = bbstreamer_recovery_injector_content,
        .finalize = bbstreamer_recovery_injector_finalize,
        .free = bbstreamer_recovery_injector_free
 
 static void bbstreamer_lz4_compressor_finalize(bbstreamer *streamer);
 static void bbstreamer_lz4_compressor_free(bbstreamer *streamer);
 
-const bbstreamer_ops bbstreamer_lz4_compressor_ops = {
+static const bbstreamer_ops bbstreamer_lz4_compressor_ops = {
        .content = bbstreamer_lz4_compressor_content,
        .finalize = bbstreamer_lz4_compressor_finalize,
        .free = bbstreamer_lz4_compressor_free
 static void bbstreamer_lz4_decompressor_finalize(bbstreamer *streamer);
 static void bbstreamer_lz4_decompressor_free(bbstreamer *streamer);
 
-const bbstreamer_ops bbstreamer_lz4_decompressor_ops = {
+static const bbstreamer_ops bbstreamer_lz4_decompressor_ops = {
        .content = bbstreamer_lz4_decompressor_content,
        .finalize = bbstreamer_lz4_decompressor_finalize,
        .free = bbstreamer_lz4_decompressor_free
 
 static void bbstreamer_tar_parser_free(bbstreamer *streamer);
 static bool bbstreamer_tar_header(bbstreamer_tar_parser *mystreamer);
 
-const bbstreamer_ops bbstreamer_tar_parser_ops = {
+static const bbstreamer_ops bbstreamer_tar_parser_ops = {
        .content = bbstreamer_tar_parser_content,
        .finalize = bbstreamer_tar_parser_finalize,
        .free = bbstreamer_tar_parser_free
 static void bbstreamer_tar_archiver_finalize(bbstreamer *streamer);
 static void bbstreamer_tar_archiver_free(bbstreamer *streamer);
 
-const bbstreamer_ops bbstreamer_tar_archiver_ops = {
+static const bbstreamer_ops bbstreamer_tar_archiver_ops = {
        .content = bbstreamer_tar_archiver_content,
        .finalize = bbstreamer_tar_archiver_finalize,
        .free = bbstreamer_tar_archiver_free
 static void bbstreamer_tar_terminator_finalize(bbstreamer *streamer);
 static void bbstreamer_tar_terminator_free(bbstreamer *streamer);
 
-const bbstreamer_ops bbstreamer_tar_terminator_ops = {
+static const bbstreamer_ops bbstreamer_tar_terminator_ops = {
        .content = bbstreamer_tar_terminator_content,
        .finalize = bbstreamer_tar_terminator_finalize,
        .free = bbstreamer_tar_terminator_free
 
 static void bbstreamer_zstd_compressor_finalize(bbstreamer *streamer);
 static void bbstreamer_zstd_compressor_free(bbstreamer *streamer);
 
-const bbstreamer_ops bbstreamer_zstd_compressor_ops = {
+static const bbstreamer_ops bbstreamer_zstd_compressor_ops = {
        .content = bbstreamer_zstd_compressor_content,
        .finalize = bbstreamer_zstd_compressor_finalize,
        .free = bbstreamer_zstd_compressor_free
 static void bbstreamer_zstd_decompressor_finalize(bbstreamer *streamer);
 static void bbstreamer_zstd_decompressor_free(bbstreamer *streamer);
 
-const bbstreamer_ops bbstreamer_zstd_decompressor_ops = {
+static const bbstreamer_ops bbstreamer_zstd_decompressor_ops = {
        .content = bbstreamer_zstd_decompressor_content,
        .finalize = bbstreamer_zstd_decompressor_finalize,
        .free = bbstreamer_zstd_decompressor_free
 
 static bool dir_finish(WalWriteMethod *wwmethod);
 static void dir_free(WalWriteMethod *wwmethod);
 
-const WalWriteMethodOps WalDirectoryMethodOps = {
+static const WalWriteMethodOps WalDirectoryMethodOps = {
        .open_for_write = dir_open_for_write,
        .close = dir_close,
        .existsfile = dir_existsfile,
 static bool tar_finish(WalWriteMethod *wwmethod);
 static void tar_free(WalWriteMethod *wwmethod);
 
-const WalWriteMethodOps WalTarMethodOps = {
+static const WalWriteMethodOps WalTarMethodOps = {
        .open_for_write = tar_open_for_write,
        .close = tar_close,
        .existsfile = tar_existsfile,
 
 /*
  * Progress status information.
  */
-int64          total_size = 0;
-int64          current_size = 0;
+static int64 total_size = 0;
+static int64 current_size = 0;
 static pg_time_t last_progress_report = 0;
 
 static void
 
 } cb_tablespace;
 
 /* Directories to be removed if we exit uncleanly. */
-cb_cleanup_dir *cleanup_dir_list = NULL;
+static cb_cleanup_dir *cleanup_dir_list = NULL;
 
 static void add_tablespace_mapping(cb_options *opt, char *arg);
 static StringInfo check_backup_label_files(int n_backups, char **backup_dirs);
 
 static ControlFileData ControlFile_source;
 static ControlFileData ControlFile_source_after;
 
-const char *progname;
+static const char *progname;
 int                    WalSegSz;
 
 /* Configuration options */
 char      *datadir_target = NULL;
-char      *datadir_source = NULL;
-char      *connstr_source = NULL;
-char      *restore_command = NULL;
-char      *config_file = NULL;
+static char *datadir_source = NULL;
+static char *connstr_source = NULL;
+static char *restore_command = NULL;
+static char *config_file = NULL;
 
 static bool debug = false;
 bool           showprogress = false;
 bool           dry_run = false;
 bool           do_sync = true;
-bool           restore_wal = false;
+static bool restore_wal = false;
 DataDirSyncMethod sync_method = DATA_DIR_SYNC_METHOD_FSYNC;
 
 /* Target history */
 
 static void output(uint64 loop_count);
 
 /* record duration in powers of 2 microseconds */
-long long int histogram[32];
+static long long int histogram[32];
 
 int
 main(int argc, char *argv[])
 
 #define MIN_ZIPFIAN_PARAM              1.001   /* minimum parameter for zipfian */
 #define MAX_ZIPFIAN_PARAM              1000.0  /* maximum parameter for zipfian */
 
-int                    nxacts = 0;                     /* number of transactions per client */
-int                    duration = 0;           /* duration in seconds */
-int64          end_time = 0;           /* when to stop in micro seconds, under -T */
+static int     nxacts = 0;                     /* number of transactions per client */
+static int     duration = 0;           /* duration in seconds */
+static int64 end_time = 0;             /* when to stop in micro seconds, under -T */
 
 /*
  * scaling factor. for example, scale = 10 will make 1000000 tuples in
  * pgbench_accounts table.
  */
-int                    scale = 1;
+static int     scale = 1;
 
 /*
  * fillfactor. for example, fillfactor = 90 will use only 90 percent
  * space during inserts and leave 10 percent free.
  */
-int                    fillfactor = 100;
+static int     fillfactor = 100;
 
 /*
  * use unlogged tables?
  */
-bool           unlogged_tables = false;
+static bool unlogged_tables = false;
 
 /*
  * log sampling rate (1.0 = log everything, 0.0 = option not given)
  */
-double         sample_rate = 0.0;
+static double sample_rate = 0.0;
 
 /*
  * When threads are throttled to a given rate limit, this is the target delay
  * to reach that rate in usec.  0 is the default and means no throttling.
  */
-double         throttle_delay = 0;
+static double throttle_delay = 0;
 
 /*
  * Transactions which take longer than this limit (in usec) are counted as
  * throttling is enabled, execution time slots that are more than this late
  * are skipped altogether, and counted separately.
  */
-int64          latency_limit = 0;
+static int64 latency_limit = 0;
 
 /*
  * tablespace selection
  */
-char      *tablespace = NULL;
-char      *index_tablespace = NULL;
+static char *tablespace = NULL;
+static char *index_tablespace = NULL;
 
 /*
  * Number of "pgbench_accounts" partitions.  0 is the default and means no
 static const char *const PARTITION_METHOD[] = {"none", "range", "hash"};
 
 /* random seed used to initialize base_random_sequence */
-int64          random_seed = -1;
+static int64 random_seed = -1;
 
 /*
  * end of configurable parameters
  */
 #define SCALE_32BIT_THRESHOLD 20000
 
-bool           use_log;                        /* log transaction latencies to a file */
-bool           use_quiet;                      /* quiet logging onto stderr */
-int                    agg_interval;           /* log aggregates instead of individual
+static bool use_log;                   /* log transaction latencies to a file */
+static bool use_quiet;                 /* quiet logging onto stderr */
+static int     agg_interval;           /* log aggregates instead of individual
                                                                 * transactions */
-bool           per_script_stats = false;       /* whether to collect stats per script */
-int                    progress = 0;           /* thread progress report every this seconds */
-bool           progress_timestamp = false; /* progress report with Unix time */
-int                    nclients = 1;           /* number of clients */
-int                    nthreads = 1;           /* number of threads */
-bool           is_connect;                     /* establish connection for each transaction */
-bool           report_per_command = false; /* report per-command latencies,
+static bool per_script_stats = false;  /* whether to collect stats per script */
+static int     progress = 0;           /* thread progress report every this seconds */
+static bool progress_timestamp = false; /* progress report with Unix time */
+static int     nclients = 1;           /* number of clients */
+static int     nthreads = 1;           /* number of threads */
+static bool is_connect;                        /* establish connection for each transaction */
+static bool report_per_command = false; /* report per-command latencies,
                                                                                 * retries after errors and failures
                                                                                 * (errors without retrying) */
-int                    main_pid;                       /* main process id used in log filename */
+static int     main_pid;                       /* main process id used in log filename */
 
 /*
  * There are different types of restrictions for deciding that the current
  * We cannot retry a transaction after the serialization/deadlock error if its
  * number of tries reaches this maximum; if its value is zero, it is not used.
  */
-uint32         max_tries = 1;
+static uint32 max_tries = 1;
 
-bool           failures_detailed = false;      /* whether to group failures in
+static bool failures_detailed = false; /* whether to group failures in
                                                                                 * reports or logs by basic types */
 
-const char *pghost = NULL;
-const char *pgport = NULL;
-const char *username = NULL;
-const char *dbName = NULL;
-char      *logfile_prefix = NULL;
-const char *progname;
+static const char *pghost = NULL;
+static const char *pgport = NULL;
+static const char *username = NULL;
+static const char *dbName = NULL;
+static char *logfile_prefix = NULL;
+static const char *progname;
 
 #define WSEP '@'                               /* weight separator */
 
-volatile sig_atomic_t timer_exceeded = false;  /* flag from signal handler */
+volatile static sig_atomic_t timer_exceeded = false;   /* flag from signal
+                                                                                                                * handler */
 
 /*
  * We don't want to allocate variables one by one; for efficiency, add a
  * For displaying Unix epoch timestamps, as some time functions may have
  * another reference.
  */
-pg_time_usec_t epoch_shift;
+static pg_time_usec_t epoch_shift;
 
 /*
  * Error status for errors during script execution.
 
        OBJFILTER_SCHEMA_EXCLUDE = (1 << 4),    /* -N | --exclude-schema */
 } VacObjFilter;
 
-VacObjFilter objfilter = OBJFILTER_NONE;
+static VacObjFilter objfilter = OBJFILTER_NONE;
 
 static void vacuum_one_database(ConnParams *cparams,
                                                                vacuumingOptions *vacopts,
 
 
 bool           plpgsql_check_asserts = true;
 
-char      *plpgsql_extra_warnings_string = NULL;
-char      *plpgsql_extra_errors_string = NULL;
+static char *plpgsql_extra_warnings_string = NULL;
+static char *plpgsql_extra_errors_string = NULL;
 int                    plpgsql_extra_warnings;
 int                    plpgsql_extra_errors;
 
 
 #include "lib/stringinfo.h"
 #include "pg_regress.h"
 
-char           saved_argv0[MAXPGPATH];
-char           isolation_exec[MAXPGPATH];
-bool           looked_up_isolation_exec = false;
+static char saved_argv0[MAXPGPATH];
+static char isolation_exec[MAXPGPATH];
+static bool looked_up_isolation_exec = false;
 
 #define PG_ISOLATION_VERSIONSTR "isolationtester (PostgreSQL) " PG_VERSION "\n"
 
 
 PG_MODULE_MAGIC;
 
 /* parse table for fillRelOptions */
-relopt_parse_elt di_relopt_tab[6];
+static relopt_parse_elt di_relopt_tab[6];
 
 /* Kind of relation options for dummy index */
-relopt_kind di_relopt_kind;
+static relopt_kind di_relopt_kind;
 
 typedef enum DummyAmEnum
 {
        int                     option_string_null_offset;
 }                      DummyIndexOptions;
 
-relopt_enum_elt_def dummyAmEnumValues[] =
+static relopt_enum_elt_def dummyAmEnumValues[] =
 {
        {"one", DUMMY_AM_ENUM_ONE},
        {"two", DUMMY_AM_ENUM_TWO},
 
 static bool process_result(PGconn *conn, PGresult *res, int results,
                                                   int numsent);
 
-const char *const progname = "libpq_pipeline";
+static const char *const progname = "libpq_pipeline";
 
 /* Options and defaults */
-char      *tracefile = NULL;   /* path to PQtrace() file */
+static char *tracefile = NULL; /* path to PQtrace() file */
 
 
 #ifdef DEBUG_OUTPUT
 
 static JsonParseErrorType do_array_element_end(void *state, bool isnull);
 static JsonParseErrorType do_scalar(void *state, char *token, JsonTokenType tokentype);
 
-JsonSemAction sem = {
+static JsonSemAction sem = {
        .object_start = do_object_start,
        .object_end = do_object_end,
        .object_field_start = do_object_field_start,