Make all Perl warnings fatal

Started by Peter Eisentrautover 2 years ago21 messages
#1Peter Eisentraut
peter@eisentraut.org
1 attachment(s)

We have a lot of Perl scripts in the tree, mostly code generation and
TAP tests. Occasionally, these scripts produce warnings. These are
AFAICT always mistakes on the developer side (true positives). Typical
examples are warnings from genbki.pl or related when you make a mess in
the catalog files during development, or warnings from tests when they
massage a config file that looks different on different hosts, or
mistakes during merges (e.g., duplicate subroutine definitions), or just
mistakes that weren't noticed, because, you know, there is a lot of
output in a verbose build.

I wanted to figure put if we can catch these more reliably, in the style
of -Werror. AFAICT, there is no way to automatically turn all warnings
into fatal errors. But there is a way to do it per script, by replacing

use warnings;

by

use warnings FATAL => 'all';

See attached patch to try it out.

The documentation at <https://perldoc.perl.org/warnings#Fatal-Warnings&gt;
appears to sort of hand-wave against doing that. Their argument appears
to be something like, the modules you use might in the future produce
additional warnings, thus breaking your scripts. On balance, I'd take
that risk, if it means I would notice the warnings in a more timely and
robust way. But that's just me at a moment in time.

Thoughts?

Now to some funny business. If you apply this patch, the Cirrus CI
Linux tasks will fail, because they get an undefined return from
getprotobyname() in PostgreSQL/Test/Cluster.pm. Huh? I need this patch
to get past that:

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm 
b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 3fa679ff97..dfe7bc7b1a 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -1570,7 +1570,7 @@ sub can_bind
     my ($host, $port) = @_;
     my $iaddr = inet_aton($host);
     my $paddr = sockaddr_in($port, $iaddr);
-   my $proto = getprotobyname("tcp");
+   my $proto = getprotobyname("tcp") || 6;

socket(SOCK, PF_INET, SOCK_STREAM, $proto)
or die "socket failed: $!";

What is going on there? Does this host not have /etc/protocols, or
something like that?

There are also a couple of issues in the MSVC legacy build system that
would need to be tightened up in order to survive with fatal Perl
warnings. Obviously, there is a question whether it's worth spending
any time on that anymore.

Attachments:

0001-Make-all-Perl-warnings-fatal.patchtext/plain; charset=UTF-8; name=0001-Make-all-Perl-warnings-fatal.patchDownload
From 085e5dcffb7fda0ffcc103cc43dce205083d55d4 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 1 Aug 2023 13:44:16 +0200
Subject: [PATCH] Make all Perl warnings fatal

---
 config/check_modules.pl                                |  2 +-
 contrib/amcheck/t/001_verify_heapam.pl                 |  2 +-
 contrib/amcheck/t/002_cic.pl                           |  2 +-
 contrib/amcheck/t/003_cic_2pc.pl                       |  2 +-
 contrib/auto_explain/t/001_auto_explain.pl             |  2 +-
 contrib/basebackup_to_shell/t/001_basic.pl             |  2 +-
 contrib/bloom/t/001_wal.pl                             |  2 +-
 contrib/fuzzystrmatch/daitch_mokotoff_header.pl        |  2 +-
 contrib/intarray/bench/bench.pl                        |  2 +-
 contrib/intarray/bench/create_test.pl                  |  2 +-
 contrib/oid2name/t/001_basic.pl                        |  2 +-
 contrib/pg_prewarm/t/001_basic.pl                      |  2 +-
 contrib/seg/seg-validate.pl                            |  2 +-
 contrib/seg/sort-segments.pl                           |  2 +-
 contrib/test_decoding/t/001_repl_stats.pl              |  2 +-
 contrib/vacuumlo/t/001_basic.pl                        |  2 +-
 doc/src/sgml/generate-errcodes-table.pl                |  2 +-
 doc/src/sgml/generate-keywords-table.pl                |  2 +-
 doc/src/sgml/mk_feature_tables.pl                      |  2 +-
 src/backend/catalog/Catalog.pm                         |  2 +-
 src/backend/catalog/genbki.pl                          |  2 +-
 src/backend/nodes/gen_node_support.pl                  |  2 +-
 src/backend/parser/check_keywords.pl                   |  2 +-
 src/backend/snowball/snowball_create.pl                |  2 +-
 src/backend/storage/lmgr/generate-lwlocknames.pl       |  2 +-
 src/backend/utils/Gen_fmgrtab.pl                       |  2 +-
 .../utils/activity/generate-wait_event_types.pl        |  2 +-
 src/backend/utils/generate-errcodes.pl                 |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_BIG5.pl            |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl          |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl    |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl          |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl          |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl          |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_GB18030.pl         |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl           |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl  |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_SJIS.pl            |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_UHC.pl             |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_most.pl            |  2 +-
 src/backend/utils/mb/Unicode/convutils.pm              |  2 +-
 src/bin/initdb/t/001_initdb.pl                         |  2 +-
 src/bin/pg_amcheck/t/001_basic.pl                      |  2 +-
 src/bin/pg_amcheck/t/002_nonesuch.pl                   |  2 +-
 src/bin/pg_amcheck/t/003_check.pl                      |  2 +-
 src/bin/pg_amcheck/t/004_verify_heapam.pl              |  2 +-
 src/bin/pg_amcheck/t/005_opclass_damage.pl             |  2 +-
 src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl   |  2 +-
 src/bin/pg_basebackup/t/010_pg_basebackup.pl           |  2 +-
 src/bin/pg_basebackup/t/011_in_place_tablespace.pl     |  2 +-
 src/bin/pg_basebackup/t/020_pg_receivewal.pl           |  2 +-
 src/bin/pg_basebackup/t/030_pg_recvlogical.pl          |  2 +-
 src/bin/pg_checksums/t/001_basic.pl                    |  2 +-
 src/bin/pg_checksums/t/002_actions.pl                  |  2 +-
 src/bin/pg_config/t/001_pg_config.pl                   |  2 +-
 src/bin/pg_controldata/t/001_pg_controldata.pl         |  2 +-
 src/bin/pg_ctl/t/001_start_stop.pl                     |  2 +-
 src/bin/pg_ctl/t/002_status.pl                         |  2 +-
 src/bin/pg_ctl/t/003_promote.pl                        |  2 +-
 src/bin/pg_ctl/t/004_logrotate.pl                      |  2 +-
 src/bin/pg_dump/t/001_basic.pl                         |  2 +-
 src/bin/pg_dump/t/002_pg_dump.pl                       |  2 +-
 src/bin/pg_dump/t/003_pg_dump_with_server.pl           |  2 +-
 src/bin/pg_dump/t/004_pg_dump_parallel.pl              |  2 +-
 src/bin/pg_dump/t/010_dump_connstr.pl                  |  2 +-
 src/bin/pg_resetwal/t/001_basic.pl                     |  2 +-
 src/bin/pg_resetwal/t/002_corrupted.pl                 |  2 +-
 src/bin/pg_rewind/t/001_basic.pl                       |  2 +-
 src/bin/pg_rewind/t/002_databases.pl                   |  2 +-
 src/bin/pg_rewind/t/003_extrafiles.pl                  |  2 +-
 src/bin/pg_rewind/t/004_pg_xlog_symlink.pl             |  2 +-
 src/bin/pg_rewind/t/005_same_timeline.pl               |  2 +-
 src/bin/pg_rewind/t/006_options.pl                     |  2 +-
 src/bin/pg_rewind/t/007_standby_source.pl              |  2 +-
 src/bin/pg_rewind/t/008_min_recovery_point.pl          |  2 +-
 src/bin/pg_rewind/t/009_growing_files.pl               |  2 +-
 src/bin/pg_rewind/t/RewindTest.pm                      |  2 +-
 src/bin/pg_test_fsync/t/001_basic.pl                   |  2 +-
 src/bin/pg_test_timing/t/001_basic.pl                  |  2 +-
 src/bin/pg_upgrade/t/001_basic.pl                      |  2 +-
 src/bin/pg_upgrade/t/002_pg_upgrade.pl                 |  2 +-
 src/bin/pg_verifybackup/t/001_basic.pl                 |  2 +-
 src/bin/pg_verifybackup/t/002_algorithm.pl             |  2 +-
 src/bin/pg_verifybackup/t/003_corruption.pl            |  2 +-
 src/bin/pg_verifybackup/t/004_options.pl               |  2 +-
 src/bin/pg_verifybackup/t/005_bad_manifest.pl          |  2 +-
 src/bin/pg_verifybackup/t/006_encoding.pl              |  2 +-
 src/bin/pg_verifybackup/t/007_wal.pl                   |  2 +-
 src/bin/pg_verifybackup/t/008_untar.pl                 |  2 +-
 src/bin/pg_verifybackup/t/009_extract.pl               |  2 +-
 src/bin/pg_verifybackup/t/010_client_untar.pl          |  2 +-
 src/bin/pg_waldump/t/001_basic.pl                      |  2 +-
 src/bin/pg_waldump/t/002_save_fullpage.pl              |  2 +-
 src/bin/pgbench/t/001_pgbench_with_server.pl           |  2 +-
 src/bin/pgbench/t/002_pgbench_no_server.pl             |  2 +-
 src/bin/psql/create_help.pl                            |  2 +-
 src/bin/psql/t/001_basic.pl                            |  2 +-
 src/bin/psql/t/010_tab_completion.pl                   |  2 +-
 src/bin/psql/t/020_cancel.pl                           |  2 +-
 src/bin/scripts/t/010_clusterdb.pl                     |  2 +-
 src/bin/scripts/t/011_clusterdb_all.pl                 |  2 +-
 src/bin/scripts/t/020_createdb.pl                      |  2 +-
 src/bin/scripts/t/040_createuser.pl                    |  2 +-
 src/bin/scripts/t/050_dropdb.pl                        |  2 +-
 src/bin/scripts/t/070_dropuser.pl                      |  2 +-
 src/bin/scripts/t/080_pg_isready.pl                    |  2 +-
 src/bin/scripts/t/090_reindexdb.pl                     |  2 +-
 src/bin/scripts/t/091_reindexdb_all.pl                 |  2 +-
 src/bin/scripts/t/100_vacuumdb.pl                      |  2 +-
 src/bin/scripts/t/101_vacuumdb_all.pl                  |  2 +-
 src/bin/scripts/t/102_vacuumdb_stages.pl               |  2 +-
 src/bin/scripts/t/200_connstr.pl                       |  2 +-
 src/common/unicode/generate-norm_test_table.pl         |  2 +-
 .../unicode/generate-unicode_east_asian_fw_table.pl    |  2 +-
 .../unicode/generate-unicode_nonspacing_table.pl       |  2 +-
 src/common/unicode/generate-unicode_norm_table.pl      |  2 +-
 src/common/unicode/generate-unicode_normprops_table.pl |  2 +-
 src/include/catalog/duplicate_oids                     |  2 +-
 src/include/catalog/reformat_dat_file.pl               |  2 +-
 src/include/catalog/renumber_oids.pl                   |  2 +-
 src/include/catalog/unused_oids                        |  2 +-
 src/interfaces/ecpg/preproc/check_rules.pl             |  2 +-
 src/interfaces/ecpg/preproc/parse.pl                   |  2 +-
 src/interfaces/libpq/t/001_uri.pl                      |  2 +-
 src/interfaces/libpq/t/002_api.pl                      |  2 +-
 src/interfaces/libpq/t/003_load_balance_host_list.pl   |  2 +-
 src/interfaces/libpq/t/004_load_balance_dns.pl         |  2 +-
 src/pl/plperl/plc_perlboot.pl                          |  6 +++---
 src/pl/plperl/plperl_opmask.pl                         |  2 +-
 src/pl/plperl/text2macro.pl                            |  2 +-
 src/pl/plpgsql/src/generate-plerrcodes.pl              |  2 +-
 src/pl/plpython/generate-spiexceptions.pl              |  2 +-
 src/pl/tcl/generate-pltclerrcodes.pl                   |  2 +-
 src/test/authentication/t/001_password.pl              |  2 +-
 src/test/authentication/t/002_saslprep.pl              |  2 +-
 src/test/authentication/t/003_peer.pl                  |  2 +-
 src/test/authentication/t/004_file_inclusion.pl        |  2 +-
 src/test/authentication/t/005_sspi.pl                  |  2 +-
 src/test/icu/t/010_database.pl                         |  2 +-
 src/test/kerberos/t/001_auth.pl                        |  2 +-
 src/test/ldap/LdapServer.pm                            |  2 +-
 src/test/ldap/t/001_auth.pl                            |  2 +-
 src/test/ldap/t/002_bindpasswd.pl                      |  2 +-
 src/test/locale/sort-test.pl                           |  2 +-
 src/test/modules/brin/t/01_workitems.pl                |  2 +-
 src/test/modules/brin/t/02_wal_consistency.pl          |  2 +-
 src/test/modules/commit_ts/t/001_base.pl               |  2 +-
 src/test/modules/commit_ts/t/002_standby.pl            |  2 +-
 src/test/modules/commit_ts/t/003_standby_2.pl          |  2 +-
 src/test/modules/commit_ts/t/004_restart.pl            |  2 +-
 .../ldap_password_func/t/001_mutated_bindpasswd.pl     |  2 +-
 .../modules/libpq_pipeline/t/001_libpq_pipeline.pl     |  2 +-
 .../modules/ssl_passphrase_callback/t/001_testfunc.pl  |  2 +-
 src/test/modules/test_custom_rmgrs/t/001_basic.pl      |  2 +-
 .../modules/test_misc/t/001_constraint_validation.pl   |  2 +-
 src/test/modules/test_misc/t/002_tablespace.pl         |  2 +-
 src/test/modules/test_misc/t/003_check_guc.pl          |  2 +-
 src/test/modules/test_misc/t/004_io_direct.pl          |  2 +-
 src/test/modules/test_pg_dump/t/001_base.pl            |  2 +-
 src/test/modules/worker_spi/t/001_worker_spi.pl        |  2 +-
 src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm         |  2 +-
 src/test/perl/PostgreSQL/Test/BackgroundPsql.pm        |  2 +-
 src/test/perl/PostgreSQL/Test/Cluster.pm               |  2 +-
 src/test/perl/PostgreSQL/Test/RecursiveCopy.pm         |  2 +-
 src/test/perl/PostgreSQL/Test/SimpleTee.pm             |  2 +-
 src/test/perl/PostgreSQL/Test/Utils.pm                 |  2 +-
 src/test/perl/PostgreSQL/Version.pm                    |  2 +-
 src/test/perl/README                                   |  2 +-
 src/test/recovery/t/001_stream_rep.pl                  |  2 +-
 src/test/recovery/t/002_archiving.pl                   |  2 +-
 src/test/recovery/t/003_recovery_targets.pl            |  2 +-
 src/test/recovery/t/004_timeline_switch.pl             |  2 +-
 src/test/recovery/t/005_replay_delay.pl                |  2 +-
 src/test/recovery/t/006_logical_decoding.pl            |  2 +-
 src/test/recovery/t/007_sync_rep.pl                    |  2 +-
 src/test/recovery/t/008_fsm_truncation.pl              |  2 +-
 src/test/recovery/t/009_twophase.pl                    |  2 +-
 src/test/recovery/t/010_logical_decoding_timelines.pl  |  2 +-
 src/test/recovery/t/012_subtransactions.pl             |  2 +-
 src/test/recovery/t/013_crash_restart.pl               |  2 +-
 src/test/recovery/t/014_unlogged_reinit.pl             |  2 +-
 src/test/recovery/t/015_promotion_pages.pl             |  2 +-
 src/test/recovery/t/016_min_consistency.pl             |  2 +-
 src/test/recovery/t/017_shm.pl                         |  2 +-
 src/test/recovery/t/018_wal_optimize.pl                |  2 +-
 src/test/recovery/t/019_replslot_limit.pl              |  2 +-
 src/test/recovery/t/020_archive_status.pl              |  2 +-
 src/test/recovery/t/021_row_visibility.pl              |  2 +-
 src/test/recovery/t/022_crash_temp_files.pl            |  2 +-
 src/test/recovery/t/023_pitr_prepared_xact.pl          |  2 +-
 src/test/recovery/t/024_archive_recovery.pl            |  2 +-
 src/test/recovery/t/025_stuck_on_old_timeline.pl       |  2 +-
 src/test/recovery/t/026_overwrite_contrecord.pl        |  2 +-
 src/test/recovery/t/027_stream_regress.pl              |  2 +-
 src/test/recovery/t/028_pitr_timelines.pl              |  2 +-
 src/test/recovery/t/029_stats_restart.pl               |  2 +-
 src/test/recovery/t/030_stats_cleanup_replica.pl       |  2 +-
 src/test/recovery/t/031_recovery_conflict.pl           |  2 +-
 src/test/recovery/t/032_relfilenode_reuse.pl           |  2 +-
 src/test/recovery/t/033_replay_tsp_drops.pl            |  2 +-
 src/test/recovery/t/034_create_database.pl             |  2 +-
 src/test/recovery/t/035_standby_logical_decoding.pl    |  2 +-
 src/test/recovery/t/036_truncated_dropped.pl           |  2 +-
 src/test/recovery/t/037_invalid_database.pl            |  2 +-
 src/test/recovery/t/cp_history_files                   |  2 +-
 src/test/ssl/t/001_ssltests.pl                         |  4 +++-
 src/test/ssl/t/002_scram.pl                            |  2 +-
 src/test/ssl/t/003_sslinfo.pl                          |  2 +-
 src/test/ssl/t/SSL/Backend/OpenSSL.pm                  |  2 +-
 src/test/ssl/t/SSL/Server.pm                           |  2 +-
 src/test/subscription/t/001_rep_changes.pl             |  2 +-
 src/test/subscription/t/002_types.pl                   |  2 +-
 src/test/subscription/t/003_constraints.pl             |  2 +-
 src/test/subscription/t/004_sync.pl                    |  2 +-
 src/test/subscription/t/005_encoding.pl                |  2 +-
 src/test/subscription/t/006_rewrite.pl                 |  2 +-
 src/test/subscription/t/007_ddl.pl                     |  2 +-
 src/test/subscription/t/008_diff_schema.pl             |  2 +-
 src/test/subscription/t/009_matviews.pl                |  2 +-
 src/test/subscription/t/010_truncate.pl                |  2 +-
 src/test/subscription/t/011_generated.pl               |  2 +-
 src/test/subscription/t/012_collation.pl               |  2 +-
 src/test/subscription/t/013_partition.pl               |  2 +-
 src/test/subscription/t/014_binary.pl                  |  2 +-
 src/test/subscription/t/015_stream.pl                  |  2 +-
 src/test/subscription/t/016_stream_subxact.pl          |  2 +-
 src/test/subscription/t/017_stream_ddl.pl              |  2 +-
 src/test/subscription/t/018_stream_subxact_abort.pl    |  2 +-
 .../subscription/t/019_stream_subxact_ddl_abort.pl     |  2 +-
 src/test/subscription/t/020_messages.pl                |  2 +-
 src/test/subscription/t/021_twophase.pl                |  2 +-
 src/test/subscription/t/022_twophase_cascade.pl        |  2 +-
 src/test/subscription/t/023_twophase_stream.pl         |  2 +-
 src/test/subscription/t/024_add_drop_pub.pl            |  2 +-
 src/test/subscription/t/025_rep_changes_for_schema.pl  |  2 +-
 src/test/subscription/t/026_stats.pl                   |  2 +-
 src/test/subscription/t/027_nosuperuser.pl             |  2 +-
 src/test/subscription/t/028_row_filter.pl              |  2 +-
 src/test/subscription/t/029_on_error.pl                |  2 +-
 src/test/subscription/t/030_origin.pl                  |  2 +-
 src/test/subscription/t/031_column_list.pl             |  2 +-
 src/test/subscription/t/032_subscribe_use_index.pl     |  2 +-
 src/test/subscription/t/033_run_as_table_owner.pl      |  2 +-
 src/test/subscription/t/100_bugs.pl                    |  2 +-
 src/tools/PerfectHash.pm                               |  2 +-
 src/tools/check_bison_recursion.pl                     |  2 +-
 src/tools/ci/windows_build_config.pl                   |  2 +-
 src/tools/copyright.pl                                 |  2 +-
 src/tools/fix-old-flex-code.pl                         |  2 +-
 src/tools/gen_export.pl                                |  2 +-
 src/tools/gen_keywordlist.pl                           |  2 +-
 src/tools/git_changelog                                |  2 +-
 src/tools/mark_pgdllimport.pl                          |  2 +-
 src/tools/msvc/Install.pm                              |  2 +-
 src/tools/msvc/MSBuildProject.pm                       | 10 +++++-----
 src/tools/msvc/Mkvcbuild.pm                            |  2 +-
 src/tools/msvc/Project.pm                              |  2 +-
 src/tools/msvc/Solution.pm                             | 10 +++++-----
 src/tools/msvc/VSObjectFactory.pm                      |  2 +-
 src/tools/msvc/build.pl                                |  2 +-
 src/tools/msvc/config_default.pl                       |  2 +-
 src/tools/msvc/dummylib/Win32.pm                       |  2 +-
 src/tools/msvc/dummylib/Win32/Registry.pm              |  2 +-
 src/tools/msvc/dummylib/Win32API/File.pm               |  2 +-
 src/tools/msvc/gendef.pl                               |  2 +-
 src/tools/msvc/install.pl                              |  2 +-
 src/tools/msvc/mkvcbuild.pl                            |  2 +-
 src/tools/msvc/pgbison.pl                              |  2 +-
 src/tools/msvc/pgflex.pl                               |  2 +-
 src/tools/msvc/vcregress.pl                            |  2 +-
 src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl         |  2 +-
 src/tools/pginclude/pgcheckdefines                     |  2 +-
 src/tools/pgindent/pgindent                            |  2 +-
 src/tools/version_stamp.pl                             |  2 +-
 src/tools/win32tzlist.pl                               |  2 +-
 275 files changed, 287 insertions(+), 285 deletions(-)

diff --git a/config/check_modules.pl b/config/check_modules.pl
index 611f3a673f..1599abcc0b 100644
--- a/config/check_modules.pl
+++ b/config/check_modules.pl
@@ -5,7 +5,7 @@
 # but specify them anyway for documentation's sake.)
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config;
 
 use IPC::Run 0.79;
diff --git a/contrib/amcheck/t/001_verify_heapam.pl b/contrib/amcheck/t/001_verify_heapam.pl
index 46d5b53181..c9caa48169 100644
--- a/contrib/amcheck/t/001_verify_heapam.pl
+++ b/contrib/amcheck/t/001_verify_heapam.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/amcheck/t/002_cic.pl b/contrib/amcheck/t/002_cic.pl
index 42a047a357..f0b5d8f7e4 100644
--- a/contrib/amcheck/t/002_cic.pl
+++ b/contrib/amcheck/t/002_cic.pl
@@ -3,7 +3,7 @@
 
 # Test CREATE INDEX CONCURRENTLY with concurrent modifications
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/amcheck/t/003_cic_2pc.pl b/contrib/amcheck/t/003_cic_2pc.pl
index 3279a2505a..a5eb2d9d69 100644
--- a/contrib/amcheck/t/003_cic_2pc.pl
+++ b/contrib/amcheck/t/003_cic_2pc.pl
@@ -3,7 +3,7 @@
 
 # Test CREATE INDEX CONCURRENTLY with concurrent prepared-xact modifications
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/auto_explain/t/001_auto_explain.pl b/contrib/auto_explain/t/001_auto_explain.pl
index abb422f8de..2720215dbc 100644
--- a/contrib/auto_explain/t/001_auto_explain.pl
+++ b/contrib/auto_explain/t/001_auto_explain.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/basebackup_to_shell/t/001_basic.pl b/contrib/basebackup_to_shell/t/001_basic.pl
index e2cdd2ecb0..221f5b2296 100644
--- a/contrib/basebackup_to_shell/t/001_basic.pl
+++ b/contrib/basebackup_to_shell/t/001_basic.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/bloom/t/001_wal.pl b/contrib/bloom/t/001_wal.pl
index 2a69ff1a74..7e8c2b1a3d 100644
--- a/contrib/bloom/t/001_wal.pl
+++ b/contrib/bloom/t/001_wal.pl
@@ -3,7 +3,7 @@
 
 # Test generic xlog record work for bloom index replication.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/contrib/fuzzystrmatch/daitch_mokotoff_header.pl b/contrib/fuzzystrmatch/daitch_mokotoff_header.pl
index 51a40e7748..5ee0d1cc7c 100755
--- a/contrib/fuzzystrmatch/daitch_mokotoff_header.pl
+++ b/contrib/fuzzystrmatch/daitch_mokotoff_header.pl
@@ -9,7 +9,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 die "Usage: $0 OUTPUT_FILE\n" if @ARGV != 1;
 my $output_file = $ARGV[0];
diff --git a/contrib/intarray/bench/bench.pl b/contrib/intarray/bench/bench.pl
index 067654986e..ba8163ce11 100755
--- a/contrib/intarray/bench/bench.pl
+++ b/contrib/intarray/bench/bench.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # make sure we are in a sane environment.
 use DBI();
diff --git a/contrib/intarray/bench/create_test.pl b/contrib/intarray/bench/create_test.pl
index 6efe9151ca..f6ffc5b452 100755
--- a/contrib/intarray/bench/create_test.pl
+++ b/contrib/intarray/bench/create_test.pl
@@ -5,7 +5,7 @@
 # contrib/intarray/bench/create_test.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print <<EOT;
 create table message (
diff --git a/contrib/oid2name/t/001_basic.pl b/contrib/oid2name/t/001_basic.pl
index 74fe622916..ac361a0139 100644
--- a/contrib/oid2name/t/001_basic.pl
+++ b/contrib/oid2name/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/contrib/pg_prewarm/t/001_basic.pl b/contrib/pg_prewarm/t/001_basic.pl
index 6b7c869afc..b2f86c1a25 100644
--- a/contrib/pg_prewarm/t/001_basic.pl
+++ b/contrib/pg_prewarm/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/seg/seg-validate.pl b/contrib/seg/seg-validate.pl
index 67c0015e6b..b21af13140 100755
--- a/contrib/seg/seg-validate.pl
+++ b/contrib/seg/seg-validate.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $integer = '[+-]?[0-9]+';
 my $real = '[+-]?[0-9]+\.[0-9]+';
diff --git a/contrib/seg/sort-segments.pl b/contrib/seg/sort-segments.pl
index 3cc21a3ba0..9bd71c0391 100755
--- a/contrib/seg/sort-segments.pl
+++ b/contrib/seg/sort-segments.pl
@@ -5,7 +5,7 @@
 # this script will sort any table with the segment data type in its last column
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my @rows;
 
diff --git a/contrib/test_decoding/t/001_repl_stats.pl b/contrib/test_decoding/t/001_repl_stats.pl
index 7c2d87561c..da466bdacf 100644
--- a/contrib/test_decoding/t/001_repl_stats.pl
+++ b/contrib/test_decoding/t/001_repl_stats.pl
@@ -4,7 +4,7 @@
 # Test replication statistics data in pg_stat_replication_slots is sane after
 # drop replication slot and restart.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/vacuumlo/t/001_basic.pl b/contrib/vacuumlo/t/001_basic.pl
index 75067863de..4e6566d86b 100644
--- a/contrib/vacuumlo/t/001_basic.pl
+++ b/contrib/vacuumlo/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/doc/src/sgml/generate-errcodes-table.pl b/doc/src/sgml/generate-errcodes-table.pl
index 51f22bde95..e4df6d9ece 100644
--- a/doc/src/sgml/generate-errcodes-table.pl
+++ b/doc/src/sgml/generate-errcodes-table.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "<!-- autogenerated from src/backend/utils/errcodes.txt, do not edit -->\n";
diff --git a/doc/src/sgml/generate-keywords-table.pl b/doc/src/sgml/generate-keywords-table.pl
index ee44edaa6c..145d131670 100644
--- a/doc/src/sgml/generate-keywords-table.pl
+++ b/doc/src/sgml/generate-keywords-table.pl
@@ -5,7 +5,7 @@
 # Copyright (c) 2019-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my @sql_versions = reverse sort ('1992', '2016', '2023');
 
diff --git a/doc/src/sgml/mk_feature_tables.pl b/doc/src/sgml/mk_feature_tables.pl
index 824be729a0..69b1d3a1a7 100644
--- a/doc/src/sgml/mk_feature_tables.pl
+++ b/doc/src/sgml/mk_feature_tables.pl
@@ -3,7 +3,7 @@
 # doc/src/sgml/mk_feature_tables.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $yesno = $ARGV[0];
 
diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index b15f513183..4f1e9b5181 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -14,7 +14,7 @@
 package Catalog;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Compare;
 
diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index 4a7205472c..dc6f13a89b 100644
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -14,7 +14,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/backend/nodes/gen_node_support.pl b/src/backend/nodes/gen_node_support.pl
index 72c7963578..c7091d6bf2 100644
--- a/src/backend/nodes/gen_node_support.pl
+++ b/src/backend/nodes/gen_node_support.pl
@@ -16,7 +16,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 use Getopt::Long;
diff --git a/src/backend/parser/check_keywords.pl b/src/backend/parser/check_keywords.pl
index e9b6f40eaa..cc58ce88a9 100644
--- a/src/backend/parser/check_keywords.pl
+++ b/src/backend/parser/check_keywords.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2009-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $gram_filename = $ARGV[0];
 my $kwlist_filename = $ARGV[1];
diff --git a/src/backend/snowball/snowball_create.pl b/src/backend/snowball/snowball_create.pl
index 35d1cd9621..f1c5d160de 100644
--- a/src/backend/snowball/snowball_create.pl
+++ b/src/backend/snowball/snowball_create.pl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $outdir_path = '';
diff --git a/src/backend/storage/lmgr/generate-lwlocknames.pl b/src/backend/storage/lmgr/generate-lwlocknames.pl
index 863c88252b..34bac0faf5 100644
--- a/src/backend/storage/lmgr/generate-lwlocknames.pl
+++ b/src/backend/storage/lmgr/generate-lwlocknames.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $output_path = '.';
diff --git a/src/backend/utils/Gen_fmgrtab.pl b/src/backend/utils/Gen_fmgrtab.pl
index 764216c56d..d0f3652136 100644
--- a/src/backend/utils/Gen_fmgrtab.pl
+++ b/src/backend/utils/Gen_fmgrtab.pl
@@ -17,7 +17,7 @@
 use Catalog;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $output_path = '';
diff --git a/src/backend/utils/activity/generate-wait_event_types.pl b/src/backend/utils/activity/generate-wait_event_types.pl
index 56335e8730..3fcca4b311 100644
--- a/src/backend/utils/activity/generate-wait_event_types.pl
+++ b/src/backend/utils/activity/generate-wait_event_types.pl
@@ -14,7 +14,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $output_path = '.';
diff --git a/src/backend/utils/generate-errcodes.pl b/src/backend/utils/generate-errcodes.pl
index 34d0f25c23..42730e8c1a 100644
--- a/src/backend/utils/generate-errcodes.pl
+++ b/src/backend/utils/generate-errcodes.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $outfile = '';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl b/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
index 4c5724b8b7..41fe881e1b 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
@@ -25,7 +25,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
index f9ff2bd3d2..a14e4ac820 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
@@ -14,7 +14,7 @@
 # and the "b" field is the hex byte sequence for GB18030
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
index 2d0e05fb79..4b77ecc694 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
@@ -8,7 +8,7 @@
 # "euc-jis-2004-std.txt" (http://x0213.org)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
index 4073578027..41c825dbe7 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
@@ -12,7 +12,7 @@
 # organization's ftp site.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
index 9112e1cfe9..ff2a644012 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
@@ -17,7 +17,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
index 4ad17064ab..d2a3dac589 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
@@ -18,7 +18,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
index 9c8a983bf7..88c9c374b2 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
@@ -14,7 +14,7 @@
 # and the "b" field is the hex byte sequence for GB18030
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl b/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
index f50baa8f1f..decf8ab443 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
@@ -16,7 +16,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
index ed010a58fa..eb57ca89c5 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
@@ -8,7 +8,7 @@
 # "sjis-0213-2004-std.txt" (http://x0213.org)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
index 0808c6836b..3ef8960ade 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
@@ -11,7 +11,7 @@
 # ftp site.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_UHC.pl b/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
index 207677d76d..cc8b7d804c 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
@@ -14,7 +14,7 @@
 # and the "b" field is the hex byte sequence for UHC
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_most.pl b/src/backend/utils/mb/Unicode/UCS_to_most.pl
index a1947308ff..2a095b7d7d 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_most.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_most.pl
@@ -16,7 +16,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/convutils.pm b/src/backend/utils/mb/Unicode/convutils.pm
index 77de7b1a4d..0f55d9621b 100644
--- a/src/backend/utils/mb/Unicode/convutils.pm
+++ b/src/backend/utils/mb/Unicode/convutils.pm
@@ -6,7 +6,7 @@
 package convutils;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Exporter 'import';
diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl
index 2d7469d2fc..407ca92968 100644
--- a/src/bin/initdb/t/001_initdb.pl
+++ b/src/bin/initdb/t/001_initdb.pl
@@ -6,7 +6,7 @@
 # Successful initdb consumes much time and I/O.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Fcntl ':mode';
 use File::stat qw{lstat};
 use PostgreSQL::Test::Cluster;
diff --git a/src/bin/pg_amcheck/t/001_basic.pl b/src/bin/pg_amcheck/t/001_basic.pl
index 1f1e33278b..9737d965aa 100644
--- a/src/bin/pg_amcheck/t/001_basic.pl
+++ b/src/bin/pg_amcheck/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_amcheck/t/002_nonesuch.pl b/src/bin/pg_amcheck/t/002_nonesuch.pl
index 99b94dd022..df7ff5397a 100644
--- a/src/bin/pg_amcheck/t/002_nonesuch.pl
+++ b/src/bin/pg_amcheck/t/002_nonesuch.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_amcheck/t/003_check.pl b/src/bin/pg_amcheck/t/003_check.pl
index d577cffa30..3727906f98 100644
--- a/src/bin/pg_amcheck/t/003_check.pl
+++ b/src/bin/pg_amcheck/t/003_check.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_amcheck/t/004_verify_heapam.pl b/src/bin/pg_amcheck/t/004_verify_heapam.pl
index 1b5027c420..0f57adabe6 100644
--- a/src/bin/pg_amcheck/t/004_verify_heapam.pl
+++ b/src/bin/pg_amcheck/t/004_verify_heapam.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_amcheck/t/005_opclass_damage.pl b/src/bin/pg_amcheck/t/005_opclass_damage.pl
index fd476179f4..f2ea5fed40 100644
--- a/src/bin/pg_amcheck/t/005_opclass_damage.pl
+++ b/src/bin/pg_amcheck/t/005_opclass_damage.pl
@@ -5,7 +5,7 @@
 # presence of breaking sort order changes.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
index 18a82ff002..279c438345 100644
--- a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
+++ b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index b9f5e1266b..c4c197ae1a 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename qw(basename dirname);
 use File::Path     qw(rmtree);
 use PostgreSQL::Test::Cluster;
diff --git a/src/bin/pg_basebackup/t/011_in_place_tablespace.pl b/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
index d58696e8f9..da7154362e 100644
--- a/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
+++ b/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_basebackup/t/020_pg_receivewal.pl b/src/bin/pg_basebackup/t/020_pg_receivewal.pl
index 374f090a8b..765049ee96 100644
--- a/src/bin/pg_basebackup/t/020_pg_receivewal.pl
+++ b/src/bin/pg_basebackup/t/020_pg_receivewal.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
index 62dca5b67a..1bbe88da14 100644
--- a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
+++ b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/pg_checksums/t/001_basic.pl b/src/bin/pg_checksums/t/001_basic.pl
index d3601a5dd8..cfc147b77c 100644
--- a/src/bin/pg_checksums/t/001_basic.pl
+++ b/src/bin/pg_checksums/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.pl
index 2d63182d59..207dc8ec9c 100644
--- a/src/bin/pg_checksums/t/002_actions.pl
+++ b/src/bin/pg_checksums/t/002_actions.pl
@@ -5,7 +5,7 @@
 # an initialized cluster.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 
diff --git a/src/bin/pg_config/t/001_pg_config.pl b/src/bin/pg_config/t/001_pg_config.pl
index 24acf7872b..693f7be054 100644
--- a/src/bin/pg_config/t/001_pg_config.pl
+++ b/src/bin/pg_config/t/001_pg_config.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_controldata/t/001_pg_controldata.pl b/src/bin/pg_controldata/t/001_pg_controldata.pl
index 0c641036e9..eed301030e 100644
--- a/src/bin/pg_controldata/t/001_pg_controldata.pl
+++ b/src/bin/pg_controldata/t/001_pg_controldata.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index f019fe1703..e072916dfa 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_ctl/t/002_status.pl b/src/bin/pg_ctl/t/002_status.pl
index f5c50f6a7d..95bba696a4 100644
--- a/src/bin/pg_ctl/t/002_status.pl
+++ b/src/bin/pg_ctl/t/002_status.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_ctl/t/003_promote.pl b/src/bin/pg_ctl/t/003_promote.pl
index 0e83933098..f38e02f4a2 100644
--- a/src/bin/pg_ctl/t/003_promote.pl
+++ b/src/bin/pg_ctl/t/003_promote.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_ctl/t/004_logrotate.pl b/src/bin/pg_ctl/t/004_logrotate.pl
index 8d48e56ee9..912d89b5d6 100644
--- a/src/bin/pg_ctl/t/004_logrotate.pl
+++ b/src/bin/pg_ctl/t/004_logrotate.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/001_basic.pl b/src/bin/pg_dump/t/001_basic.pl
index 8c63d31cb6..60f0e1de45 100644
--- a/src/bin/pg_dump/t/001_basic.pl
+++ b/src/bin/pg_dump/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 6ad8310287..7935d1d3e5 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/003_pg_dump_with_server.pl b/src/bin/pg_dump/t/003_pg_dump_with_server.pl
index ab025c44a4..e21de45ba2 100644
--- a/src/bin/pg_dump/t/003_pg_dump_with_server.pl
+++ b/src/bin/pg_dump/t/003_pg_dump_with_server.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/004_pg_dump_parallel.pl b/src/bin/pg_dump/t/004_pg_dump_parallel.pl
index c4b461ed87..c14391f58b 100644
--- a/src/bin/pg_dump/t/004_pg_dump_parallel.pl
+++ b/src/bin/pg_dump/t/004_pg_dump_parallel.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/010_dump_connstr.pl b/src/bin/pg_dump/t/010_dump_connstr.pl
index ed86c332ef..f03e1e08cc 100644
--- a/src/bin/pg_dump/t/010_dump_connstr.pl
+++ b/src/bin/pg_dump/t/010_dump_connstr.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_resetwal/t/001_basic.pl b/src/bin/pg_resetwal/t/001_basic.pl
index 7e5efbf56b..5c2c5908e9 100644
--- a/src/bin/pg_resetwal/t/001_basic.pl
+++ b/src/bin/pg_resetwal/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_resetwal/t/002_corrupted.pl b/src/bin/pg_resetwal/t/002_corrupted.pl
index 6d19a1efd5..7cc42d70eb 100644
--- a/src/bin/pg_resetwal/t/002_corrupted.pl
+++ b/src/bin/pg_resetwal/t/002_corrupted.pl
@@ -4,7 +4,7 @@
 # Tests for handling a corrupted pg_control
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_rewind/t/001_basic.pl b/src/bin/pg_rewind/t/001_basic.pl
index c7b48255a7..842f6c7fbe 100644
--- a/src/bin/pg_rewind/t/001_basic.pl
+++ b/src/bin/pg_rewind/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/002_databases.pl b/src/bin/pg_rewind/t/002_databases.pl
index 0d480aedb4..313b2486e1 100644
--- a/src/bin/pg_rewind/t/002_databases.pl
+++ b/src/bin/pg_rewind/t/002_databases.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/003_extrafiles.pl b/src/bin/pg_rewind/t/003_extrafiles.pl
index fd2bee5d20..6e040239c4 100644
--- a/src/bin/pg_rewind/t/003_extrafiles.pl
+++ b/src/bin/pg_rewind/t/003_extrafiles.pl
@@ -4,7 +4,7 @@
 # Test how pg_rewind reacts to extra files and directories in the data dirs.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index 5fb7fa9077..7d1bb65cae 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -5,7 +5,7 @@
 # Test pg_rewind when the target's pg_wal directory is a symlink.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Copy;
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_rewind/t/005_same_timeline.pl b/src/bin/pg_rewind/t/005_same_timeline.pl
index b4ef05e560..57e04b0ce2 100644
--- a/src/bin/pg_rewind/t/005_same_timeline.pl
+++ b/src/bin/pg_rewind/t/005_same_timeline.pl
@@ -6,7 +6,7 @@
 # on the same timeline runs successfully.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/006_options.pl b/src/bin/pg_rewind/t/006_options.pl
index 4b6e39a47c..c346b370a6 100644
--- a/src/bin/pg_rewind/t/006_options.pl
+++ b/src/bin/pg_rewind/t/006_options.pl
@@ -5,7 +5,7 @@
 # Test checking options of pg_rewind.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/007_standby_source.pl b/src/bin/pg_rewind/t/007_standby_source.pl
index 4fd1ed001c..fab84a4bbb 100644
--- a/src/bin/pg_rewind/t/007_standby_source.pl
+++ b/src/bin/pg_rewind/t/007_standby_source.pl
@@ -25,7 +25,7 @@
 # as is.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/008_min_recovery_point.pl b/src/bin/pg_rewind/t/008_min_recovery_point.pl
index d4c89451e6..287e4555b5 100644
--- a/src/bin/pg_rewind/t/008_min_recovery_point.pl
+++ b/src/bin/pg_rewind/t/008_min_recovery_point.pl
@@ -31,7 +31,7 @@
 # nodes.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_rewind/t/009_growing_files.pl b/src/bin/pg_rewind/t/009_growing_files.pl
index cf60a04ae7..016f7736e7 100644
--- a/src/bin/pg_rewind/t/009_growing_files.pl
+++ b/src/bin/pg_rewind/t/009_growing_files.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm
index 8fbbd521cb..23144f19e8 100644
--- a/src/bin/pg_rewind/t/RewindTest.pm
+++ b/src/bin/pg_rewind/t/RewindTest.pm
@@ -32,7 +32,7 @@ package RewindTest;
 # to run psql against the primary and standby servers, respectively.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Exporter 'import';
diff --git a/src/bin/pg_test_fsync/t/001_basic.pl b/src/bin/pg_test_fsync/t/001_basic.pl
index 401ad2c07c..135e68b9ba 100644
--- a/src/bin/pg_test_fsync/t/001_basic.pl
+++ b/src/bin/pg_test_fsync/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_test_timing/t/001_basic.pl b/src/bin/pg_test_timing/t/001_basic.pl
index 43bc68cb37..628a603f85 100644
--- a/src/bin/pg_test_timing/t/001_basic.pl
+++ b/src/bin/pg_test_timing/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_upgrade/t/001_basic.pl b/src/bin/pg_upgrade/t/001_basic.pl
index ceac4e0851..6f7117cec6 100644
--- a/src/bin/pg_upgrade/t/001_basic.pl
+++ b/src/bin/pg_upgrade/t/001_basic.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index a5688a1cf2..a484064b54 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -2,7 +2,7 @@
 
 # Set of tests for pg_upgrade, including cross-version checks.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd            qw(abs_path);
 use File::Basename qw(dirname);
diff --git a/src/bin/pg_verifybackup/t/001_basic.pl b/src/bin/pg_verifybackup/t/001_basic.pl
index 73e8663238..f1127c827a 100644
--- a/src/bin/pg_verifybackup/t/001_basic.pl
+++ b/src/bin/pg_verifybackup/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_verifybackup/t/002_algorithm.pl b/src/bin/pg_verifybackup/t/002_algorithm.pl
index 5b02ea4d55..c9f0c10f83 100644
--- a/src/bin/pg_verifybackup/t/002_algorithm.pl
+++ b/src/bin/pg_verifybackup/t/002_algorithm.pl
@@ -4,7 +4,7 @@
 # Verify that we can take and verify backups with various checksum types.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/003_corruption.pl b/src/bin/pg_verifybackup/t/003_corruption.pl
index 4cc3dd05e3..273a6ff77b 100644
--- a/src/bin/pg_verifybackup/t/003_corruption.pl
+++ b/src/bin/pg_verifybackup/t/003_corruption.pl
@@ -4,7 +4,7 @@
 # Verify that various forms of corruption are detected by pg_verifybackup.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/004_options.pl b/src/bin/pg_verifybackup/t/004_options.pl
index 2aa8352f00..f6b092b58a 100644
--- a/src/bin/pg_verifybackup/t/004_options.pl
+++ b/src/bin/pg_verifybackup/t/004_options.pl
@@ -4,7 +4,7 @@
 # Verify the behavior of assorted pg_verifybackup options.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/005_bad_manifest.pl b/src/bin/pg_verifybackup/t/005_bad_manifest.pl
index c94fdd5df8..d481ea1f02 100644
--- a/src/bin/pg_verifybackup/t/005_bad_manifest.pl
+++ b/src/bin/pg_verifybackup/t/005_bad_manifest.pl
@@ -5,7 +5,7 @@
 # problems.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_verifybackup/t/006_encoding.pl b/src/bin/pg_verifybackup/t/006_encoding.pl
index 0b37bda20c..3831a28272 100644
--- a/src/bin/pg_verifybackup/t/006_encoding.pl
+++ b/src/bin/pg_verifybackup/t/006_encoding.pl
@@ -4,7 +4,7 @@
 # Verify that pg_verifybackup handles hex-encoded filenames correctly.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_verifybackup/t/007_wal.pl b/src/bin/pg_verifybackup/t/007_wal.pl
index 89f96f85db..ea3d60b242 100644
--- a/src/bin/pg_verifybackup/t/007_wal.pl
+++ b/src/bin/pg_verifybackup/t/007_wal.pl
@@ -4,7 +4,7 @@
 # Test pg_verifybackup's WAL verification.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_verifybackup/t/008_untar.pl b/src/bin/pg_verifybackup/t/008_untar.pl
index 1a783d1188..7f0f2245f6 100644
--- a/src/bin/pg_verifybackup/t/008_untar.pl
+++ b/src/bin/pg_verifybackup/t/008_untar.pl
@@ -6,7 +6,7 @@
 # format.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/009_extract.pl b/src/bin/pg_verifybackup/t/009_extract.pl
index f4d5378555..e8e4f60768 100644
--- a/src/bin/pg_verifybackup/t/009_extract.pl
+++ b/src/bin/pg_verifybackup/t/009_extract.pl
@@ -5,7 +5,7 @@
 # a backup which was compressed by the server.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/010_client_untar.pl b/src/bin/pg_verifybackup/t/010_client_untar.pl
index 44d83e777f..64907f0cae 100644
--- a/src/bin/pg_verifybackup/t/010_client_untar.pl
+++ b/src/bin/pg_verifybackup/t/010_client_untar.pl
@@ -5,7 +5,7 @@
 # backup that didn't start out in plain format.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_waldump/t/001_basic.pl b/src/bin/pg_waldump/t/001_basic.pl
index 029a0d0521..b805283385 100644
--- a/src/bin/pg_waldump/t/001_basic.pl
+++ b/src/bin/pg_waldump/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_waldump/t/002_save_fullpage.pl b/src/bin/pg_waldump/t/002_save_fullpage.pl
index f0725805f2..ed6726c486 100644
--- a/src/bin/pg_waldump/t/002_save_fullpage.pl
+++ b/src/bin/pg_waldump/t/002_save_fullpage.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename;
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::RecursiveCopy;
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl
index 142f966300..3f4d2fec7c 100644
--- a/src/bin/pgbench/t/001_pgbench_with_server.pl
+++ b/src/bin/pgbench/t/001_pgbench_with_server.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pgbench/t/002_pgbench_no_server.pl b/src/bin/pgbench/t/002_pgbench_no_server.pl
index 0ec54fbb03..1596b256dd 100644
--- a/src/bin/pgbench/t/002_pgbench_no_server.pl
+++ b/src/bin/pgbench/t/002_pgbench_no_server.pl
@@ -6,7 +6,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/psql/create_help.pl b/src/bin/psql/create_help.pl
index 0809db4151..def02465d5 100644
--- a/src/bin/psql/create_help.pl
+++ b/src/bin/psql/create_help.pl
@@ -20,7 +20,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $docdir = '';
diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl
index 9ac27db212..b7bc73a197 100644
--- a/src/bin/psql/t/001_basic.pl
+++ b/src/bin/psql/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use locale;
 
 use PostgreSQL::Test::Cluster;
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl
index 4cd0fa4680..44fdd056fa 100644
--- a/src/bin/psql/t/010_tab_completion.pl
+++ b/src/bin/psql/t/010_tab_completion.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/psql/t/020_cancel.pl b/src/bin/psql/t/020_cancel.pl
index 0765d82b92..7b51b77075 100644
--- a/src/bin/psql/t/020_cancel.pl
+++ b/src/bin/psql/t/020_cancel.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/010_clusterdb.pl b/src/bin/scripts/t/010_clusterdb.pl
index 715207fb4d..60792c2eea 100644
--- a/src/bin/scripts/t/010_clusterdb.pl
+++ b/src/bin/scripts/t/010_clusterdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/011_clusterdb_all.pl b/src/bin/scripts/t/011_clusterdb_all.pl
index 35f0b18f50..26315d0a51 100644
--- a/src/bin/scripts/t/011_clusterdb_all.pl
+++ b/src/bin/scripts/t/011_clusterdb_all.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl
index 40291924e5..8815477672 100644
--- a/src/bin/scripts/t/020_createdb.pl
+++ b/src/bin/scripts/t/020_createdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/040_createuser.pl b/src/bin/scripts/t/040_createuser.pl
index 3290e30c88..75dd7331ba 100644
--- a/src/bin/scripts/t/040_createuser.pl
+++ b/src/bin/scripts/t/040_createuser.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/050_dropdb.pl b/src/bin/scripts/t/050_dropdb.pl
index 3ed670bb0a..e5acab9a38 100644
--- a/src/bin/scripts/t/050_dropdb.pl
+++ b/src/bin/scripts/t/050_dropdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/070_dropuser.pl b/src/bin/scripts/t/070_dropuser.pl
index 95c24c4f30..74947e8ca7 100644
--- a/src/bin/scripts/t/070_dropuser.pl
+++ b/src/bin/scripts/t/070_dropuser.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/080_pg_isready.pl b/src/bin/scripts/t/080_pg_isready.pl
index 8f53aef573..9784006465 100644
--- a/src/bin/scripts/t/080_pg_isready.pl
+++ b/src/bin/scripts/t/080_pg_isready.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl
index b663d0e741..7ed71849c3 100644
--- a/src/bin/scripts/t/090_reindexdb.pl
+++ b/src/bin/scripts/t/090_reindexdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/091_reindexdb_all.pl b/src/bin/scripts/t/091_reindexdb_all.pl
index 7f3e081ceb..fdb198b4e7 100644
--- a/src/bin/scripts/t/091_reindexdb_all.pl
+++ b/src/bin/scripts/t/091_reindexdb_all.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl
index eccfcc54a1..17f911efa2 100644
--- a/src/bin/scripts/t/100_vacuumdb.pl
+++ b/src/bin/scripts/t/100_vacuumdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/101_vacuumdb_all.pl b/src/bin/scripts/t/101_vacuumdb_all.pl
index 8d7c3ab014..673a94d005 100644
--- a/src/bin/scripts/t/101_vacuumdb_all.pl
+++ b/src/bin/scripts/t/101_vacuumdb_all.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/scripts/t/102_vacuumdb_stages.pl b/src/bin/scripts/t/102_vacuumdb_stages.pl
index 64d7ed1575..c1174fd5e8 100644
--- a/src/bin/scripts/t/102_vacuumdb_stages.pl
+++ b/src/bin/scripts/t/102_vacuumdb_stages.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/scripts/t/200_connstr.pl b/src/bin/scripts/t/200_connstr.pl
index 53c5e21ab2..4f3d9ffe98 100644
--- a/src/bin/scripts/t/200_connstr.pl
+++ b/src/bin/scripts/t/200_connstr.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/common/unicode/generate-norm_test_table.pl b/src/common/unicode/generate-norm_test_table.pl
index 3434f7e263..fb1718047f 100644
--- a/src/common/unicode/generate-norm_test_table.pl
+++ b/src/common/unicode/generate-norm_test_table.pl
@@ -8,7 +8,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 
diff --git a/src/common/unicode/generate-unicode_east_asian_fw_table.pl b/src/common/unicode/generate-unicode_east_asian_fw_table.pl
index 2b2df375ed..6037fdae2c 100644
--- a/src/common/unicode/generate-unicode_east_asian_fw_table.pl
+++ b/src/common/unicode/generate-unicode_east_asian_fw_table.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2019-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $range_start = undef;
 my ($first, $last);
diff --git a/src/common/unicode/generate-unicode_nonspacing_table.pl b/src/common/unicode/generate-unicode_nonspacing_table.pl
index ae86e82922..521b939943 100644
--- a/src/common/unicode/generate-unicode_nonspacing_table.pl
+++ b/src/common/unicode/generate-unicode_nonspacing_table.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2019-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $range_start = undef;
 my $codepoint;
diff --git a/src/common/unicode/generate-unicode_norm_table.pl b/src/common/unicode/generate-unicode_norm_table.pl
index d5914118ab..65b001d065 100644
--- a/src/common/unicode/generate-unicode_norm_table.pl
+++ b/src/common/unicode/generate-unicode_norm_table.pl
@@ -9,7 +9,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/common/unicode/generate-unicode_normprops_table.pl b/src/common/unicode/generate-unicode_normprops_table.pl
index 1b7473180b..f831c2d0d5 100644
--- a/src/common/unicode/generate-unicode_normprops_table.pl
+++ b/src/common/unicode/generate-unicode_normprops_table.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2020-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib "$FindBin::RealBin/../../tools/";
diff --git a/src/include/catalog/duplicate_oids b/src/include/catalog/duplicate_oids
index eb5c3fb084..1830b95b0a 100755
--- a/src/include/catalog/duplicate_oids
+++ b/src/include/catalog/duplicate_oids
@@ -17,7 +17,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Must run in src/include/catalog
 use FindBin;
diff --git a/src/include/catalog/reformat_dat_file.pl b/src/include/catalog/reformat_dat_file.pl
index 725117d846..b5235c24d3 100755
--- a/src/include/catalog/reformat_dat_file.pl
+++ b/src/include/catalog/reformat_dat_file.pl
@@ -18,7 +18,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use Getopt::Long;
diff --git a/src/include/catalog/renumber_oids.pl b/src/include/catalog/renumber_oids.pl
index ec09584959..a418b33d58 100755
--- a/src/include/catalog/renumber_oids.pl
+++ b/src/include/catalog/renumber_oids.pl
@@ -16,7 +16,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use Getopt::Long;
diff --git a/src/include/catalog/unused_oids b/src/include/catalog/unused_oids
index ccf3c3f781..f5f0c57b74 100755
--- a/src/include/catalog/unused_oids
+++ b/src/include/catalog/unused_oids
@@ -19,7 +19,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Must run in src/include/catalog
 use FindBin;
diff --git a/src/interfaces/ecpg/preproc/check_rules.pl b/src/interfaces/ecpg/preproc/check_rules.pl
index 5e823fa30e..6417ee7315 100644
--- a/src/interfaces/ecpg/preproc/check_rules.pl
+++ b/src/interfaces/ecpg/preproc/check_rules.pl
@@ -17,7 +17,7 @@
 # Then it checks to make sure each rule in ecpg.addons was found in gram.y
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $srcdir = '.';
diff --git a/src/interfaces/ecpg/preproc/parse.pl b/src/interfaces/ecpg/preproc/parse.pl
index 7574fc3110..b0caeb356f 100644
--- a/src/interfaces/ecpg/preproc/parse.pl
+++ b/src/interfaces/ecpg/preproc/parse.pl
@@ -13,7 +13,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $srcdir = '.';
diff --git a/src/interfaces/libpq/t/001_uri.pl b/src/interfaces/libpq/t/001_uri.pl
index fd062a95c5..cd876e758f 100644
--- a/src/interfaces/libpq/t/001_uri.pl
+++ b/src/interfaces/libpq/t/001_uri.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/interfaces/libpq/t/002_api.pl b/src/interfaces/libpq/t/002_api.pl
index 8b43a984fb..9d376bcaa2 100644
--- a/src/interfaces/libpq/t/002_api.pl
+++ b/src/interfaces/libpq/t/002_api.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/interfaces/libpq/t/003_load_balance_host_list.pl b/src/interfaces/libpq/t/003_load_balance_host_list.pl
index 21c3b8dd33..c6fe049fe5 100644
--- a/src/interfaces/libpq/t/003_load_balance_host_list.pl
+++ b/src/interfaces/libpq/t/003_load_balance_host_list.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config;
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
diff --git a/src/interfaces/libpq/t/004_load_balance_dns.pl b/src/interfaces/libpq/t/004_load_balance_dns.pl
index 875070e212..81cf628ac7 100644
--- a/src/interfaces/libpq/t/004_load_balance_dns.pl
+++ b/src/interfaces/libpq/t/004_load_balance_dns.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config;
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
diff --git a/src/pl/plperl/plc_perlboot.pl b/src/pl/plperl/plc_perlboot.pl
index 13298013d3..90c1b7e667 100644
--- a/src/pl/plperl/plc_perlboot.pl
+++ b/src/pl/plperl/plc_perlboot.pl
@@ -4,7 +4,7 @@
 #  src/pl/plperl/plc_perlboot.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use vars qw(%_SHARED $_TD);
 
@@ -58,7 +58,7 @@ sub ::encode_array_constructor
 	package PostgreSQL::InServer;  ## no critic (RequireFilenameMatchesPackage)
 #>>>
 	use strict;
-	use warnings;
+	use warnings FATAL => 'all';
 
 	sub plperl_warn
 	{
@@ -107,7 +107,7 @@ sub ::encode_array_constructor
 
 	package PostgreSQL::InServer::ARRAY;
 	use strict;
-	use warnings;
+	use warnings FATAL => 'all';
 
 	use overload
 	  '""' => \&to_str,
diff --git a/src/pl/plperl/plperl_opmask.pl b/src/pl/plperl/plperl_opmask.pl
index 26ac717770..09dc72d273 100644
--- a/src/pl/plperl/plperl_opmask.pl
+++ b/src/pl/plperl/plperl_opmask.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Opcode qw(opset opset_to_ops opdesc);
 
diff --git a/src/pl/plperl/text2macro.pl b/src/pl/plperl/text2macro.pl
index 933632c0df..7a41da84c6 100644
--- a/src/pl/plperl/text2macro.pl
+++ b/src/pl/plperl/text2macro.pl
@@ -27,7 +27,7 @@ =head1 DESCRIPTION
 =cut
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Getopt::Long;
 
diff --git a/src/pl/plpgsql/src/generate-plerrcodes.pl b/src/pl/plpgsql/src/generate-plerrcodes.pl
index f4fd376ef9..03ce58b94e 100644
--- a/src/pl/plpgsql/src/generate-plerrcodes.pl
+++ b/src/pl/plpgsql/src/generate-plerrcodes.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
diff --git a/src/pl/plpython/generate-spiexceptions.pl b/src/pl/plpython/generate-spiexceptions.pl
index 61b37c3541..090e20472c 100644
--- a/src/pl/plpython/generate-spiexceptions.pl
+++ b/src/pl/plpython/generate-spiexceptions.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
diff --git a/src/pl/tcl/generate-pltclerrcodes.pl b/src/pl/tcl/generate-pltclerrcodes.pl
index 9c2309108c..df1ba7d4d4 100644
--- a/src/pl/tcl/generate-pltclerrcodes.pl
+++ b/src/pl/tcl/generate-pltclerrcodes.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
diff --git a/src/test/authentication/t/001_password.pl b/src/test/authentication/t/001_password.pl
index 12552837a8..56b3cd0ab7 100644
--- a/src/test/authentication/t/001_password.pl
+++ b/src/test/authentication/t/001_password.pl
@@ -9,7 +9,7 @@
 # This test can only run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/002_saslprep.pl b/src/test/authentication/t/002_saslprep.pl
index ef15831166..c3a73dfda1 100644
--- a/src/test/authentication/t/002_saslprep.pl
+++ b/src/test/authentication/t/002_saslprep.pl
@@ -6,7 +6,7 @@
 # This test can only run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/003_peer.pl b/src/test/authentication/t/003_peer.pl
index eacff2b52a..96217b6661 100644
--- a/src/test/authentication/t/003_peer.pl
+++ b/src/test/authentication/t/003_peer.pl
@@ -6,7 +6,7 @@
 # and is only able to run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/004_file_inclusion.pl b/src/test/authentication/t/004_file_inclusion.pl
index 55d28ad586..364bba81ca 100644
--- a/src/test/authentication/t/004_file_inclusion.pl
+++ b/src/test/authentication/t/004_file_inclusion.pl
@@ -5,7 +5,7 @@
 # only run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use File::Basename qw(basename);
diff --git a/src/test/authentication/t/005_sspi.pl b/src/test/authentication/t/005_sspi.pl
index 37fd5bc243..bdc829dcf8 100644
--- a/src/test/authentication/t/005_sspi.pl
+++ b/src/test/authentication/t/005_sspi.pl
@@ -4,7 +4,7 @@
 # Tests targeting SSPI on Windows.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/icu/t/010_database.pl b/src/test/icu/t/010_database.pl
index 0e9446cebe..083c6f26e2 100644
--- a/src/test/icu/t/010_database.pl
+++ b/src/test/icu/t/010_database.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index 0deb9bffc8..e9ceb712f5 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -18,7 +18,7 @@
 # See the README for additional information.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/test/ldap/LdapServer.pm b/src/test/ldap/LdapServer.pm
index a4c1a1843c..f63844d60a 100644
--- a/src/test/ldap/LdapServer.pm
+++ b/src/test/ldap/LdapServer.pm
@@ -46,7 +46,7 @@ LdapServer - class for an LDAP server for testing pg_hba.conf authentication
 package LdapServer;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 3e113fd6eb..5e569c4db9 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib "$FindBin::RealBin/..";
diff --git a/src/test/ldap/t/002_bindpasswd.pl b/src/test/ldap/t/002_bindpasswd.pl
index bcd4aa2b74..204ed39059 100644
--- a/src/test/ldap/t/002_bindpasswd.pl
+++ b/src/test/ldap/t/002_bindpasswd.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib "$FindBin::RealBin/..";
diff --git a/src/test/locale/sort-test.pl b/src/test/locale/sort-test.pl
index 8bed29b3ad..47efa8f8bb 100755
--- a/src/test/locale/sort-test.pl
+++ b/src/test/locale/sort-test.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use locale;
 
 open(my $in_fh, '<', $ARGV[0]) || die;
diff --git a/src/test/modules/brin/t/01_workitems.pl b/src/test/modules/brin/t/01_workitems.pl
index 5f71074231..376c3a43f1 100644
--- a/src/test/modules/brin/t/01_workitems.pl
+++ b/src/test/modules/brin/t/01_workitems.pl
@@ -4,7 +4,7 @@
 # Verify that work items work correctly
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/brin/t/02_wal_consistency.pl b/src/test/modules/brin/t/02_wal_consistency.pl
index 8b2b244feb..a588a28669 100644
--- a/src/test/modules/brin/t/02_wal_consistency.pl
+++ b/src/test/modules/brin/t/02_wal_consistency.pl
@@ -3,7 +3,7 @@
 # Verify WAL consistency
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/001_base.pl b/src/test/modules/commit_ts/t/001_base.pl
index ae3fc5f52d..d6ea0c4c69 100644
--- a/src/test/modules/commit_ts/t/001_base.pl
+++ b/src/test/modules/commit_ts/t/001_base.pl
@@ -4,7 +4,7 @@
 # Single-node test: value can be set, and is still present after recovery
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/002_standby.pl b/src/test/modules/commit_ts/t/002_standby.pl
index 59cc2b1244..e843578ddb 100644
--- a/src/test/modules/commit_ts/t/002_standby.pl
+++ b/src/test/modules/commit_ts/t/002_standby.pl
@@ -4,7 +4,7 @@
 # Test simple scenario involving a standby
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl
index 5af511e369..b38c3c0f26 100644
--- a/src/test/modules/commit_ts/t/003_standby_2.pl
+++ b/src/test/modules/commit_ts/t/003_standby_2.pl
@@ -4,7 +4,7 @@
 # Test primary/standby scenario where the track_commit_timestamp GUC is
 # repeatedly toggled on and off.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/004_restart.pl b/src/test/modules/commit_ts/t/004_restart.pl
index 8fe4bedb14..399268ebee 100644
--- a/src/test/modules/commit_ts/t/004_restart.pl
+++ b/src/test/modules/commit_ts/t/004_restart.pl
@@ -3,7 +3,7 @@
 
 # Testing of commit timestamps preservation across restarts
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl b/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
index c96c8d7a4d..b7ac65091a 100644
--- a/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
+++ b/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2022, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Copy;
 use FindBin;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
index 056fa5c6d2..71a11ddf25 100644
--- a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
+++ b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
index 2b2c144ee2..c63e7bd394 100644
--- a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
+++ b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Copy;
 
diff --git a/src/test/modules/test_custom_rmgrs/t/001_basic.pl b/src/test/modules/test_custom_rmgrs/t/001_basic.pl
index 50655d3788..dc3d830299 100644
--- a/src/test/modules/test_custom_rmgrs/t/001_basic.pl
+++ b/src/test/modules/test_custom_rmgrs/t/001_basic.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/test_misc/t/001_constraint_validation.pl b/src/test/modules/test_misc/t/001_constraint_validation.pl
index 5a07a5d36d..4d0ea0c59d 100644
--- a/src/test/modules/test_misc/t/001_constraint_validation.pl
+++ b/src/test/modules/test_misc/t/001_constraint_validation.pl
@@ -4,7 +4,7 @@
 # Verify that ALTER TABLE optimizes certain operations as expected
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/test_misc/t/002_tablespace.pl b/src/test/modules/test_misc/t/002_tablespace.pl
index f774a021a8..220e2b073d 100644
--- a/src/test/modules/test_misc/t/002_tablespace.pl
+++ b/src/test/modules/test_misc/t/002_tablespace.pl
@@ -3,7 +3,7 @@
 # regression tests.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/test_misc/t/003_check_guc.pl b/src/test/modules/test_misc/t/003_check_guc.pl
index 4fd6d03b9e..5dab498c22 100644
--- a/src/test/modules/test_misc/t/003_check_guc.pl
+++ b/src/test/modules/test_misc/t/003_check_guc.pl
@@ -2,7 +2,7 @@
 # postgresql.conf.sample.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/test_misc/t/004_io_direct.pl b/src/test/modules/test_misc/t/004_io_direct.pl
index dddcfb1aa9..e3f0966b8d 100644
--- a/src/test/modules/test_misc/t/004_io_direct.pl
+++ b/src/test/modules/test_misc/t/004_io_direct.pl
@@ -1,7 +1,7 @@
 # Very simple exercise of direct I/O GUC.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Fcntl;
 use IO::File;
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl
index d00c3544e9..bf7f92d13f 100644
--- a/src/test/modules/test_pg_dump/t/001_base.pl
+++ b/src/test/modules/test_pg_dump/t/001_base.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/worker_spi/t/001_worker_spi.pl b/src/test/modules/worker_spi/t/001_worker_spi.pl
index c3e7f5fbe6..05981b97ae 100644
--- a/src/test/modules/worker_spi/t/001_worker_spi.pl
+++ b/src/test/modules/worker_spi/t/001_worker_spi.pl
@@ -3,7 +3,7 @@
 # Test worker_spi module.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
index e34dfb9243..1b1078f8c6 100644
--- a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
+++ b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
@@ -30,7 +30,7 @@ compare the results of cross-version upgrade tests.
 package PostgreSQL::Test::AdjustUpgrade;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Exporter 'import';
 use PostgreSQL::Version;
diff --git a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
index 924b57ab21..bd41c8bd10 100644
--- a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
+++ b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
@@ -54,7 +54,7 @@ initiated by PostgreSQL::Test::Cluster.
 package PostgreSQL::Test::BackgroundPsql;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Config;
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 5e161dbee6..3fa679ff97 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -97,7 +97,7 @@ The IPC::Run module is required.
 package PostgreSQL::Test::Cluster;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Config;
diff --git a/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm b/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
index 15964e6217..1c79bfabd1 100644
--- a/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
+++ b/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
@@ -19,7 +19,7 @@ PostgreSQL::Test::RecursiveCopy::copypath($from, $to);
 package PostgreSQL::Test::RecursiveCopy;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use File::Basename;
diff --git a/src/test/perl/PostgreSQL/Test/SimpleTee.pm b/src/test/perl/PostgreSQL/Test/SimpleTee.pm
index 82099bf503..9258b7c4cd 100644
--- a/src/test/perl/PostgreSQL/Test/SimpleTee.pm
+++ b/src/test/perl/PostgreSQL/Test/SimpleTee.pm
@@ -17,7 +17,7 @@
 
 package PostgreSQL::Test::SimpleTee;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Time::HiRes qw(time);
 
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index 617caa022f..ca13574966 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -42,7 +42,7 @@ aimed at controlling command execution, logging and test functions.
 package PostgreSQL::Test::Utils;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Config;
diff --git a/src/test/perl/PostgreSQL/Version.pm b/src/test/perl/PostgreSQL/Version.pm
index 3705c1bdaf..dadc90fecc 100644
--- a/src/test/perl/PostgreSQL/Version.pm
+++ b/src/test/perl/PostgreSQL/Version.pm
@@ -45,7 +45,7 @@ of common version formats and comparison operations.
 package PostgreSQL::Version;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Scalar::Util qw(blessed);
 
diff --git a/src/test/perl/README b/src/test/perl/README
index 8fb44184b9..af037a8091 100644
--- a/src/test/perl/README
+++ b/src/test/perl/README
@@ -58,7 +58,7 @@ order.
 Each test script should begin with:
 
     use strict;
-    use warnings;
+    use warnings FATAL => 'all';
     use PostgreSQL::Test::Cluster;
     use PostgreSQL::Test::Utils;
     use Test::More;
diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl
index 0c72ba0944..3526f2d554 100644
--- a/src/test/recovery/t/001_stream_rep.pl
+++ b/src/test/recovery/t/001_stream_rep.pl
@@ -3,7 +3,7 @@
 
 # Minimal test testing streaming replication
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/002_archiving.pl b/src/test/recovery/t/002_archiving.pl
index 48e00f9e29..c4d0a2a81f 100644
--- a/src/test/recovery/t/002_archiving.pl
+++ b/src/test/recovery/t/002_archiving.pl
@@ -3,7 +3,7 @@
 
 # test for archiving with hot standby
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.pl
index e882ce2077..1b63116ceb 100644
--- a/src/test/recovery/t/003_recovery_targets.pl
+++ b/src/test/recovery/t/003_recovery_targets.pl
@@ -3,7 +3,7 @@
 
 # Test for recovery targets: name, timestamp, XID
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/004_timeline_switch.pl b/src/test/recovery/t/004_timeline_switch.pl
index edaef91845..2500201b99 100644
--- a/src/test/recovery/t/004_timeline_switch.pl
+++ b/src/test/recovery/t/004_timeline_switch.pl
@@ -3,7 +3,7 @@
 
 # Test for timeline switch
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/005_replay_delay.pl b/src/test/recovery/t/005_replay_delay.pl
index 8fadca4204..2f7a99e687 100644
--- a/src/test/recovery/t/005_replay_delay.pl
+++ b/src/test/recovery/t/005_replay_delay.pl
@@ -3,7 +3,7 @@
 
 # Checks for recovery_min_apply_delay and recovery pause
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl
index 5025d65b1b..928093627e 100644
--- a/src/test/recovery/t/006_logical_decoding.pl
+++ b/src/test/recovery/t/006_logical_decoding.pl
@@ -7,7 +7,7 @@
 # is for work that doesn't fit well there, like where server restarts
 # are required.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/007_sync_rep.pl b/src/test/recovery/t/007_sync_rep.pl
index 2026af0702..b25ae1e8ec 100644
--- a/src/test/recovery/t/007_sync_rep.pl
+++ b/src/test/recovery/t/007_sync_rep.pl
@@ -3,7 +3,7 @@
 
 # Minimal test testing synchronous replication sync_state transition
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/008_fsm_truncation.pl b/src/test/recovery/t/008_fsm_truncation.pl
index acac0a0a55..10d1535a93 100644
--- a/src/test/recovery/t/008_fsm_truncation.pl
+++ b/src/test/recovery/t/008_fsm_truncation.pl
@@ -6,7 +6,7 @@
 # FSM changes don't normally need to be WAL-logged, except for truncation.
 # The FSM mustn't return a page that doesn't exist (anymore).
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl
index e1273fd0f1..cde6e2a944 100644
--- a/src/test/recovery/t/009_twophase.pl
+++ b/src/test/recovery/t/009_twophase.pl
@@ -3,7 +3,7 @@
 
 # Tests dedicated to two-phase commit in recovery
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl
index 6fbbeedde3..2359821b28 100644
--- a/src/test/recovery/t/010_logical_decoding_timelines.pl
+++ b/src/test/recovery/t/010_logical_decoding_timelines.pl
@@ -22,7 +22,7 @@
 # on logical slots).
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/012_subtransactions.pl b/src/test/recovery/t/012_subtransactions.pl
index 91ae79dd51..32434d4340 100644
--- a/src/test/recovery/t/012_subtransactions.pl
+++ b/src/test/recovery/t/012_subtransactions.pl
@@ -3,7 +3,7 @@
 
 # Tests dedicated to subtransactions in recovery
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/013_crash_restart.pl b/src/test/recovery/t/013_crash_restart.pl
index ce57792f31..0dfd197df4 100644
--- a/src/test/recovery/t/013_crash_restart.pl
+++ b/src/test/recovery/t/013_crash_restart.pl
@@ -12,7 +12,7 @@
 # backend died), or because it's already restarted.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/014_unlogged_reinit.pl b/src/test/recovery/t/014_unlogged_reinit.pl
index 3591b3309e..bee8b8804f 100644
--- a/src/test/recovery/t/014_unlogged_reinit.pl
+++ b/src/test/recovery/t/014_unlogged_reinit.pl
@@ -7,7 +7,7 @@
 # that is not tested here.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/015_promotion_pages.pl b/src/test/recovery/t/015_promotion_pages.pl
index beeb9dfddf..b49dd4c835 100644
--- a/src/test/recovery/t/015_promotion_pages.pl
+++ b/src/test/recovery/t/015_promotion_pages.pl
@@ -6,7 +6,7 @@
 # invalid page references at replay based on the minimum consistent
 # recovery point defined.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/016_min_consistency.pl b/src/test/recovery/t/016_min_consistency.pl
index 81f7a43c07..cabdd3156e 100644
--- a/src/test/recovery/t/016_min_consistency.pl
+++ b/src/test/recovery/t/016_min_consistency.pl
@@ -8,7 +8,7 @@
 # both checked.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/017_shm.pl b/src/test/recovery/t/017_shm.pl
index 74359e0e38..7935ce63d3 100644
--- a/src/test/recovery/t/017_shm.pl
+++ b/src/test/recovery/t/017_shm.pl
@@ -5,7 +5,7 @@
 # Tests of pg_shmem.h functions
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::stat qw(stat);
 use IPC::Run 'run';
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/recovery/t/018_wal_optimize.pl b/src/test/recovery/t/018_wal_optimize.pl
index 1d613eaede..0752bff174 100644
--- a/src/test/recovery/t/018_wal_optimize.pl
+++ b/src/test/recovery/t/018_wal_optimize.pl
@@ -10,7 +10,7 @@
 # For many years, individual commands made the decision to skip WAL, hence the
 # frequent appearance of COPY in these tests.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/019_replslot_limit.pl b/src/test/recovery/t/019_replslot_limit.pl
index 33e50ad933..c0b71934cf 100644
--- a/src/test/recovery/t/019_replslot_limit.pl
+++ b/src/test/recovery/t/019_replslot_limit.pl
@@ -5,7 +5,7 @@
 # Ensure that max_slot_wal_keep_size limits the number of WAL files to
 # be kept by replication slots.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/recovery/t/020_archive_status.pl b/src/test/recovery/t/020_archive_status.pl
index fa24153d4b..ce51bfb58e 100644
--- a/src/test/recovery/t/020_archive_status.pl
+++ b/src/test/recovery/t/020_archive_status.pl
@@ -5,7 +5,7 @@
 # Tests related to WAL archiving and recovery.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/021_row_visibility.pl b/src/test/recovery/t/021_row_visibility.pl
index 52a6a3509c..3bdd42c25d 100644
--- a/src/test/recovery/t/021_row_visibility.pl
+++ b/src/test/recovery/t/021_row_visibility.pl
@@ -4,7 +4,7 @@
 # Checks that snapshots on standbys behave in a minimally reasonable
 # way.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/022_crash_temp_files.pl b/src/test/recovery/t/022_crash_temp_files.pl
index 14fd8bfc7f..e702323a8f 100644
--- a/src/test/recovery/t/022_crash_temp_files.pl
+++ b/src/test/recovery/t/022_crash_temp_files.pl
@@ -3,7 +3,7 @@
 
 # Test remove of temporary files after a crash.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/023_pitr_prepared_xact.pl b/src/test/recovery/t/023_pitr_prepared_xact.pl
index a8cdf4efdd..090711ca4b 100644
--- a/src/test/recovery/t/023_pitr_prepared_xact.pl
+++ b/src/test/recovery/t/023_pitr_prepared_xact.pl
@@ -3,7 +3,7 @@
 
 # Test for point-in-time recovery (PITR) with prepared transactions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/024_archive_recovery.pl b/src/test/recovery/t/024_archive_recovery.pl
index d594332b18..e9ab11895f 100644
--- a/src/test/recovery/t/024_archive_recovery.pl
+++ b/src/test/recovery/t/024_archive_recovery.pl
@@ -3,7 +3,7 @@
 
 # Test for archive recovery of WAL generated with wal_level=minimal
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/025_stuck_on_old_timeline.pl b/src/test/recovery/t/025_stuck_on_old_timeline.pl
index 91309030df..65d8864327 100644
--- a/src/test/recovery/t/025_stuck_on_old_timeline.pl
+++ b/src/test/recovery/t/025_stuck_on_old_timeline.pl
@@ -7,7 +7,7 @@
 # archive, so the WAL files all have to be streamed.  Test that the cascading
 # standby can follow the new primary (promoted standby).
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 
diff --git a/src/test/recovery/t/026_overwrite_contrecord.pl b/src/test/recovery/t/026_overwrite_contrecord.pl
index 6807a97f26..09c7e13da9 100644
--- a/src/test/recovery/t/026_overwrite_contrecord.pl
+++ b/src/test/recovery/t/026_overwrite_contrecord.pl
@@ -3,7 +3,7 @@
 # Tests for already-propagated WAL segments ending in incomplete WAL records.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/recovery/t/027_stream_regress.pl b/src/test/recovery/t/027_stream_regress.pl
index f2f4e77626..20508307b5 100644
--- a/src/test/recovery/t/027_stream_regress.pl
+++ b/src/test/recovery/t/027_stream_regress.pl
@@ -1,6 +1,6 @@
 # Run the standard regression tests with streaming replication
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/028_pitr_timelines.pl b/src/test/recovery/t/028_pitr_timelines.pl
index bb29a2d378..58390b6d79 100644
--- a/src/test/recovery/t/028_pitr_timelines.pl
+++ b/src/test/recovery/t/028_pitr_timelines.pl
@@ -27,7 +27,7 @@
 # The actual checks are not sensitive to that.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/029_stats_restart.pl b/src/test/recovery/t/029_stats_restart.pl
index 742bd57e28..b8c7e9cd5c 100644
--- a/src/test/recovery/t/029_stats_restart.pl
+++ b/src/test/recovery/t/029_stats_restart.pl
@@ -4,7 +4,7 @@
 # invalid stats files, as well as restorting stats after "normal" restarts.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/030_stats_cleanup_replica.pl b/src/test/recovery/t/030_stats_cleanup_replica.pl
index 51495aebcd..db451d9d1b 100644
--- a/src/test/recovery/t/030_stats_cleanup_replica.pl
+++ b/src/test/recovery/t/030_stats_cleanup_replica.pl
@@ -6,7 +6,7 @@
 # - discard stats after immediate / crash restarts
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/031_recovery_conflict.pl b/src/test/recovery/t/031_recovery_conflict.pl
index 05e83fa854..c773344f50 100644
--- a/src/test/recovery/t/031_recovery_conflict.pl
+++ b/src/test/recovery/t/031_recovery_conflict.pl
@@ -5,7 +5,7 @@
 # pg_stat_database_conflicts are populated correctly
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/032_relfilenode_reuse.pl b/src/test/recovery/t/032_relfilenode_reuse.pl
index 3bc2db1a4f..8a4cceacc2 100644
--- a/src/test/recovery/t/032_relfilenode_reuse.pl
+++ b/src/test/recovery/t/032_relfilenode_reuse.pl
@@ -1,5 +1,5 @@
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/033_replay_tsp_drops.pl b/src/test/recovery/t/033_replay_tsp_drops.pl
index af97ed9f70..64c370224c 100644
--- a/src/test/recovery/t/033_replay_tsp_drops.pl
+++ b/src/test/recovery/t/033_replay_tsp_drops.pl
@@ -4,7 +4,7 @@
 # Test replay of tablespace/database creation/drop
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/034_create_database.pl b/src/test/recovery/t/034_create_database.pl
index ed562bba25..d4d7500dd5 100644
--- a/src/test/recovery/t/034_create_database.pl
+++ b/src/test/recovery/t/034_create_database.pl
@@ -4,7 +4,7 @@
 # Test WAL replay for CREATE DATABASE .. STRATEGY WAL_LOG.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/035_standby_logical_decoding.pl b/src/test/recovery/t/035_standby_logical_decoding.pl
index 480e6d6caa..1ebf50fe3e 100644
--- a/src/test/recovery/t/035_standby_logical_decoding.pl
+++ b/src/test/recovery/t/035_standby_logical_decoding.pl
@@ -4,7 +4,7 @@
 # recovery conflict and standby promotion.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/036_truncated_dropped.pl b/src/test/recovery/t/036_truncated_dropped.pl
index 2d5339d9d8..53194978fc 100644
--- a/src/test/recovery/t/036_truncated_dropped.pl
+++ b/src/test/recovery/t/036_truncated_dropped.pl
@@ -5,7 +5,7 @@
 # truncated or dropped.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/recovery/t/037_invalid_database.pl b/src/test/recovery/t/037_invalid_database.pl
index 29b9bb6977..a6b23c3ba7 100644
--- a/src/test/recovery/t/037_invalid_database.pl
+++ b/src/test/recovery/t/037_invalid_database.pl
@@ -3,7 +3,7 @@
 # Test we handle interrupted DROP DATABASE correctly.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/cp_history_files b/src/test/recovery/t/cp_history_files
index cfeea41e5b..5832b98ef4 100644
--- a/src/test/recovery/t/cp_history_files
+++ b/src/test/recovery/t/cp_history_files
@@ -2,7 +2,7 @@
 
 use File::Copy;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 die "wrong number of arguments" if @ARGV != 2;
 my ($source, $target) = @ARGV;
diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index 76442de063..860edb9ff7 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config qw ( %Config );
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
@@ -713,6 +713,8 @@ sub switch_server_cert
 	# integer like how we do when grabbing the serial fails.
 	if ($Config{ivsize} == 8)
 	{
+		no warnings qw(portable);
+
 		$serialno =~ s/^serial=//;
 		$serialno =~ s/\s+//g;
 		$serialno = hex($serialno);
diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl
index 27abd02abf..a556c66bff 100644
--- a/src/test/ssl/t/002_scram.pl
+++ b/src/test/ssl/t/002_scram.pl
@@ -4,7 +4,7 @@
 # Test SCRAM authentication and TLS channel binding types
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/ssl/t/003_sslinfo.pl b/src/test/ssl/t/003_sslinfo.pl
index 5306aad802..866fe5ad2c 100644
--- a/src/test/ssl/t/003_sslinfo.pl
+++ b/src/test/ssl/t/003_sslinfo.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/ssl/t/SSL/Backend/OpenSSL.pm b/src/test/ssl/t/SSL/Backend/OpenSSL.pm
index a762f43634..a2b44f8516 100644
--- a/src/test/ssl/t/SSL/Backend/OpenSSL.pm
+++ b/src/test/ssl/t/SSL/Backend/OpenSSL.pm
@@ -25,7 +25,7 @@ for a PostgreSQL cluster compiled against OpenSSL.
 package SSL::Backend::OpenSSL;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename;
 use File::Copy;
 
diff --git a/src/test/ssl/t/SSL/Server.pm b/src/test/ssl/t/SSL/Server.pm
index 2c5c055222..836e098902 100644
--- a/src/test/ssl/t/SSL/Server.pm
+++ b/src/test/ssl/t/SSL/Server.pm
@@ -64,7 +64,7 @@ specific infrastructure. Currently only OpenSSL is supported.
 package SSL::Server;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl
index 0a399cdb82..a69a53e19c 100644
--- a/src/test/subscription/t/001_rep_changes.pl
+++ b/src/test/subscription/t/001_rep_changes.pl
@@ -3,7 +3,7 @@
 
 # Basic logical replication test
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/002_types.pl b/src/test/subscription/t/002_types.pl
index 6b5853b80b..73f6c52977 100644
--- a/src/test/subscription/t/002_types.pl
+++ b/src/test/subscription/t/002_types.pl
@@ -4,7 +4,7 @@
 # This tests that more complex datatypes are replicated correctly
 # by logical replication
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/003_constraints.pl b/src/test/subscription/t/003_constraints.pl
index 6e902360cc..a78061b22f 100644
--- a/src/test/subscription/t/003_constraints.pl
+++ b/src/test/subscription/t/003_constraints.pl
@@ -3,7 +3,7 @@
 
 # This test checks that constraints work on subscriber
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/004_sync.pl b/src/test/subscription/t/004_sync.pl
index aa7714c533..000154b75e 100644
--- a/src/test/subscription/t/004_sync.pl
+++ b/src/test/subscription/t/004_sync.pl
@@ -3,7 +3,7 @@
 
 # Tests for logical replication table syncing
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/005_encoding.pl b/src/test/subscription/t/005_encoding.pl
index 2f0bf7730b..a7e88e42f7 100644
--- a/src/test/subscription/t/005_encoding.pl
+++ b/src/test/subscription/t/005_encoding.pl
@@ -3,7 +3,7 @@
 
 # Test replication between databases with different encodings
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/006_rewrite.pl b/src/test/subscription/t/006_rewrite.pl
index 8bc7e872d9..2a2d27f89f 100644
--- a/src/test/subscription/t/006_rewrite.pl
+++ b/src/test/subscription/t/006_rewrite.pl
@@ -3,7 +3,7 @@
 
 # Test logical replication behavior with heap rewrites
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/007_ddl.pl b/src/test/subscription/t/007_ddl.pl
index cbdb5b66e4..9bf69b35f7 100644
--- a/src/test/subscription/t/007_ddl.pl
+++ b/src/test/subscription/t/007_ddl.pl
@@ -3,7 +3,7 @@
 
 # Test some logical replication DDL behavior
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/008_diff_schema.pl b/src/test/subscription/t/008_diff_schema.pl
index c6e41b65b9..0b24cc45c2 100644
--- a/src/test/subscription/t/008_diff_schema.pl
+++ b/src/test/subscription/t/008_diff_schema.pl
@@ -3,7 +3,7 @@
 
 # Test behavior with different schema on subscriber
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/009_matviews.pl b/src/test/subscription/t/009_matviews.pl
index 38080b4313..36baf8bf3c 100644
--- a/src/test/subscription/t/009_matviews.pl
+++ b/src/test/subscription/t/009_matviews.pl
@@ -3,7 +3,7 @@
 
 # Test materialized views behavior
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/010_truncate.pl b/src/test/subscription/t/010_truncate.pl
index a5b6445392..9dc8c4d58f 100644
--- a/src/test/subscription/t/010_truncate.pl
+++ b/src/test/subscription/t/010_truncate.pl
@@ -3,7 +3,7 @@
 
 # Test TRUNCATE
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/011_generated.pl b/src/test/subscription/t/011_generated.pl
index 7711be295a..60b613a2ad 100644
--- a/src/test/subscription/t/011_generated.pl
+++ b/src/test/subscription/t/011_generated.pl
@@ -3,7 +3,7 @@
 
 # Test generated columns
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/012_collation.pl b/src/test/subscription/t/012_collation.pl
index 823550a31b..2efe201a6c 100644
--- a/src/test/subscription/t/012_collation.pl
+++ b/src/test/subscription/t/012_collation.pl
@@ -4,7 +4,7 @@
 # Test collations, in particular nondeterministic ones
 # (only works with ICU)
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/013_partition.pl b/src/test/subscription/t/013_partition.pl
index 275fb3b525..c79b89ef42 100644
--- a/src/test/subscription/t/013_partition.pl
+++ b/src/test/subscription/t/013_partition.pl
@@ -3,7 +3,7 @@
 
 # Test logical replication with partitioned tables
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/014_binary.pl b/src/test/subscription/t/014_binary.pl
index e5ce849c19..990dc4e9f1 100644
--- a/src/test/subscription/t/014_binary.pl
+++ b/src/test/subscription/t/014_binary.pl
@@ -4,7 +4,7 @@
 # Binary mode logical replication test
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/015_stream.pl b/src/test/subscription/t/015_stream.pl
index b450a78adf..79a6d094c0 100644
--- a/src/test/subscription/t/015_stream.pl
+++ b/src/test/subscription/t/015_stream.pl
@@ -3,7 +3,7 @@
 
 # Test streaming of simple large transaction
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/016_stream_subxact.pl b/src/test/subscription/t/016_stream_subxact.pl
index 838049af65..ffc02fa47c 100644
--- a/src/test/subscription/t/016_stream_subxact.pl
+++ b/src/test/subscription/t/016_stream_subxact.pl
@@ -3,7 +3,7 @@
 
 # Test streaming of transaction containing subtransactions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/017_stream_ddl.pl b/src/test/subscription/t/017_stream_ddl.pl
index d00ede44ed..9aa41ad7b4 100644
--- a/src/test/subscription/t/017_stream_ddl.pl
+++ b/src/test/subscription/t/017_stream_ddl.pl
@@ -6,7 +6,7 @@
 # This file is mainly to test the DDL/DML interaction of the publisher side,
 # so we didn't add a parallel apply version for the tests in this file.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/018_stream_subxact_abort.pl b/src/test/subscription/t/018_stream_subxact_abort.pl
index 77c96011a9..f6c759368e 100644
--- a/src/test/subscription/t/018_stream_subxact_abort.pl
+++ b/src/test/subscription/t/018_stream_subxact_abort.pl
@@ -3,7 +3,7 @@
 
 # Test streaming of transaction containing multiple subtransactions and rollbacks
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/019_stream_subxact_ddl_abort.pl b/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
index 6c2a9c5bf1..e9ab94ea97 100644
--- a/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
+++ b/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
@@ -7,7 +7,7 @@
 # This file is mainly to test the DDL/DML interaction of the publisher side,
 # so we didn't add a parallel apply version for the tests in this file.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/020_messages.pl b/src/test/subscription/t/020_messages.pl
index 826d39cd89..761e4399fd 100644
--- a/src/test/subscription/t/020_messages.pl
+++ b/src/test/subscription/t/020_messages.pl
@@ -3,7 +3,7 @@
 
 # Tests that logical decoding messages
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/021_twophase.pl b/src/test/subscription/t/021_twophase.pl
index 8ce4cfc983..d57219cb3b 100644
--- a/src/test/subscription/t/021_twophase.pl
+++ b/src/test/subscription/t/021_twophase.pl
@@ -3,7 +3,7 @@
 
 # logical replication of 2PC test
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/022_twophase_cascade.pl b/src/test/subscription/t/022_twophase_cascade.pl
index b37ed95c9e..9adbc4d1e8 100644
--- a/src/test/subscription/t/022_twophase_cascade.pl
+++ b/src/test/subscription/t/022_twophase_cascade.pl
@@ -8,7 +8,7 @@
 # Two-phase and parallel apply will be tested in 023_twophase_stream, so we
 # didn't add a parallel apply version for the tests in this file.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/023_twophase_stream.pl b/src/test/subscription/t/023_twophase_stream.pl
index fdc9e2a0f0..9f837a9811 100644
--- a/src/test/subscription/t/023_twophase_stream.pl
+++ b/src/test/subscription/t/023_twophase_stream.pl
@@ -3,7 +3,7 @@
 
 # Test logical replication of 2PC with streaming.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/024_add_drop_pub.pl b/src/test/subscription/t/024_add_drop_pub.pl
index 8614b1b5b3..0528ebf2fa 100644
--- a/src/test/subscription/t/024_add_drop_pub.pl
+++ b/src/test/subscription/t/024_add_drop_pub.pl
@@ -3,7 +3,7 @@
 
 # This test checks behaviour of ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/025_rep_changes_for_schema.pl b/src/test/subscription/t/025_rep_changes_for_schema.pl
index 8543f52710..64ec29a4b8 100644
--- a/src/test/subscription/t/025_rep_changes_for_schema.pl
+++ b/src/test/subscription/t/025_rep_changes_for_schema.pl
@@ -3,7 +3,7 @@
 
 # Logical replication tests for schema publications
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/026_stats.pl b/src/test/subscription/t/026_stats.pl
index 0bcda006cd..ad9cb8deff 100644
--- a/src/test/subscription/t/026_stats.pl
+++ b/src/test/subscription/t/026_stats.pl
@@ -3,7 +3,7 @@
 
 # Tests for subscription stats.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/027_nosuperuser.pl b/src/test/subscription/t/027_nosuperuser.pl
index d7a7e3ef5b..15b6a97721 100644
--- a/src/test/subscription/t/027_nosuperuser.pl
+++ b/src/test/subscription/t/027_nosuperuser.pl
@@ -3,7 +3,7 @@
 
 # Test that logical replication respects permissions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/subscription/t/028_row_filter.pl b/src/test/subscription/t/028_row_filter.pl
index aec483f785..9633e9e597 100644
--- a/src/test/subscription/t/028_row_filter.pl
+++ b/src/test/subscription/t/028_row_filter.pl
@@ -2,7 +2,7 @@
 
 # Test logical replication behavior with row filtering
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/029_on_error.pl b/src/test/subscription/t/029_on_error.pl
index fcab7386fe..d874e83896 100644
--- a/src/test/subscription/t/029_on_error.pl
+++ b/src/test/subscription/t/029_on_error.pl
@@ -3,7 +3,7 @@
 
 # Tests for disable_on_error and SKIP transaction features.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/030_origin.pl b/src/test/subscription/t/030_origin.pl
index 9ca1fa25d8..fa33f997e8 100644
--- a/src/test/subscription/t/030_origin.pl
+++ b/src/test/subscription/t/030_origin.pl
@@ -4,7 +4,7 @@
 # Test the CREATE SUBSCRIPTION 'origin' parameter and its interaction with
 # 'copy_data' parameter.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/031_column_list.pl b/src/test/subscription/t/031_column_list.pl
index dbff806040..35fa1e4d93 100644
--- a/src/test/subscription/t/031_column_list.pl
+++ b/src/test/subscription/t/031_column_list.pl
@@ -2,7 +2,7 @@
 
 # Test partial-column publication of tables
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/032_subscribe_use_index.pl b/src/test/subscription/t/032_subscribe_use_index.pl
index 880ef2d57a..f219140afa 100644
--- a/src/test/subscription/t/032_subscribe_use_index.pl
+++ b/src/test/subscription/t/032_subscribe_use_index.pl
@@ -2,7 +2,7 @@
 
 # Test logical replication behavior with subscriber using available index
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/033_run_as_table_owner.pl b/src/test/subscription/t/033_run_as_table_owner.pl
index 9de3c04a0c..348e183e60 100644
--- a/src/test/subscription/t/033_run_as_table_owner.pl
+++ b/src/test/subscription/t/033_run_as_table_owner.pl
@@ -3,7 +3,7 @@
 
 # Test that logical replication respects permissions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/subscription/t/100_bugs.pl b/src/test/subscription/t/100_bugs.pl
index 4fabc44168..63bd01d5a7 100644
--- a/src/test/subscription/t/100_bugs.pl
+++ b/src/test/subscription/t/100_bugs.pl
@@ -3,7 +3,7 @@
 
 # Tests for various bugs found over time
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/tools/PerfectHash.pm b/src/tools/PerfectHash.pm
index e54905a3ef..0587107962 100644
--- a/src/tools/PerfectHash.pm
+++ b/src/tools/PerfectHash.pm
@@ -30,7 +30,7 @@
 package PerfectHash;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 
 # At runtime, we'll compute two simple hash functions of the input key,
diff --git a/src/tools/check_bison_recursion.pl b/src/tools/check_bison_recursion.pl
index 18f14ad127..2f079a01a7 100755
--- a/src/tools/check_bison_recursion.pl
+++ b/src/tools/check_bison_recursion.pl
@@ -22,7 +22,7 @@
 #################################################################
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $debug = 0;
 
diff --git a/src/tools/ci/windows_build_config.pl b/src/tools/ci/windows_build_config.pl
index b0d4360c74..a3eb96b7fd 100644
--- a/src/tools/ci/windows_build_config.pl
+++ b/src/tools/ci/windows_build_config.pl
@@ -1,5 +1,5 @@
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 our $config;
 
diff --git a/src/tools/copyright.pl b/src/tools/copyright.pl
index 30c38c757b..4263b5a3eb 100755
--- a/src/tools/copyright.pl
+++ b/src/tools/copyright.pl
@@ -10,7 +10,7 @@
 #################################################################
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Find;
 use File::Basename;
diff --git a/src/tools/fix-old-flex-code.pl b/src/tools/fix-old-flex-code.pl
index d88e68b8b6..c9b0517ed4 100644
--- a/src/tools/fix-old-flex-code.pl
+++ b/src/tools/fix-old-flex-code.pl
@@ -16,7 +16,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Get command line argument.
 usage() if $#ARGV != 0;
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
index ed60abe956..08f839ed07 100644
--- a/src/tools/gen_export.pl
+++ b/src/tools/gen_export.pl
@@ -1,5 +1,5 @@
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $format;
diff --git a/src/tools/gen_keywordlist.pl b/src/tools/gen_keywordlist.pl
index 97a9ff1b30..2ad9c9a4a3 100644
--- a/src/tools/gen_keywordlist.pl
+++ b/src/tools/gen_keywordlist.pl
@@ -29,7 +29,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/tools/git_changelog b/src/tools/git_changelog
index 39e1b1fe15..f3c225d556 100755
--- a/src/tools/git_changelog
+++ b/src/tools/git_changelog
@@ -50,7 +50,7 @@
 
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 require Time::Local;
 require Getopt::Long;
 require IPC::Open2;
diff --git a/src/tools/mark_pgdllimport.pl b/src/tools/mark_pgdllimport.pl
index 45b4e73bff..a0ff7f0e2b 100755
--- a/src/tools/mark_pgdllimport.pl
+++ b/src/tools/mark_pgdllimport.pl
@@ -23,7 +23,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 for my $include_file (@ARGV)
 {
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index 05548d7c0a..39cf83ab5e 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -9,7 +9,7 @@ package Install;
 # src/tools/msvc/Install.pm
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Carp;
 use File::Basename;
 use File::Copy;
diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm
index 62fec1fee5..6a6fb0e230 100644
--- a/src/tools/msvc/MSBuildProject.pm
+++ b/src/tools/msvc/MSBuildProject.pm
@@ -11,7 +11,7 @@ package MSBuildProject;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Project);
 
 no warnings qw(redefine);    ## no critic
@@ -412,7 +412,7 @@ package VC2015Project;
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(MSBuildProject);
 
 no warnings qw(redefine);    ## no critic
@@ -437,7 +437,7 @@ package VC2017Project;
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(MSBuildProject);
 
 no warnings qw(redefine);    ## no critic
@@ -462,7 +462,7 @@ package VC2019Project;
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(MSBuildProject);
 
 no warnings qw(redefine);    ## no critic
@@ -487,7 +487,7 @@ package VC2022Project;
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(MSBuildProject);
 
 no warnings qw(redefine);    ## no critic
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 9e05eb91b1..91cdd56888 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -9,7 +9,7 @@ package Mkvcbuild;
 # src/tools/msvc/Mkvcbuild.pm
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use if ($^O eq "MSWin32"), 'Win32';
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
index 0507ad08c5..6e87c94b82 100644
--- a/src/tools/msvc/Project.pm
+++ b/src/tools/msvc/Project.pm
@@ -10,7 +10,7 @@ package Project;
 #
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename;
 
 sub _new
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 1cbc857e35..117b0bfe8f 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -10,7 +10,7 @@ package Solution;
 #
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use VSObjectFactory;
 
 no warnings qw(redefine);    ## no critic
@@ -1240,7 +1240,7 @@ package VS2015Solution;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Solution);
 
 no warnings qw(redefine);    ## no critic
@@ -1268,7 +1268,7 @@ package VS2017Solution;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Solution);
 
 no warnings qw(redefine);    ## no critic
@@ -1296,7 +1296,7 @@ package VS2019Solution;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Solution);
 
 no warnings qw(redefine);    ## no critic
@@ -1324,7 +1324,7 @@ package VS2022Solution;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Solution);
 
 no warnings qw(redefine);    ## no critic
diff --git a/src/tools/msvc/VSObjectFactory.pm b/src/tools/msvc/VSObjectFactory.pm
index 9df2ab4282..2850ad8b3d 100644
--- a/src/tools/msvc/VSObjectFactory.pm
+++ b/src/tools/msvc/VSObjectFactory.pm
@@ -11,7 +11,7 @@ package VSObjectFactory;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Exporter;
 use Project;
diff --git a/src/tools/msvc/build.pl b/src/tools/msvc/build.pl
index 9853e5c3d8..a6934ed0ff 100644
--- a/src/tools/msvc/build.pl
+++ b/src/tools/msvc/build.pl
@@ -8,7 +8,7 @@
 # src/tools/msvc/build.pl
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib $FindBin::RealBin;
diff --git a/src/tools/msvc/config_default.pl b/src/tools/msvc/config_default.pl
index 8945e772c2..0b40f6e38f 100644
--- a/src/tools/msvc/config_default.pl
+++ b/src/tools/msvc/config_default.pl
@@ -3,7 +3,7 @@
 
 # Configuration arguments for vcbuild.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 our $config = {
 	asserts => 0,    # --enable-cassert
diff --git a/src/tools/msvc/dummylib/Win32.pm b/src/tools/msvc/dummylib/Win32.pm
index df2d7a2929..6c483d60a2 100644
--- a/src/tools/msvc/dummylib/Win32.pm
+++ b/src/tools/msvc/dummylib/Win32.pm
@@ -3,5 +3,5 @@
 
 package Win32;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 1;
diff --git a/src/tools/msvc/dummylib/Win32/Registry.pm b/src/tools/msvc/dummylib/Win32/Registry.pm
index e14636eb31..0abf53cb04 100644
--- a/src/tools/msvc/dummylib/Win32/Registry.pm
+++ b/src/tools/msvc/dummylib/Win32/Registry.pm
@@ -4,7 +4,7 @@
 package Win32::Registry;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use vars qw($HKEY_LOCAL_MACHINE);
 
diff --git a/src/tools/msvc/dummylib/Win32API/File.pm b/src/tools/msvc/dummylib/Win32API/File.pm
index 7baf34c4e5..42c066acbb 100644
--- a/src/tools/msvc/dummylib/Win32API/File.pm
+++ b/src/tools/msvc/dummylib/Win32API/File.pm
@@ -4,7 +4,7 @@
 package Win32API::File;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use constant { SEM_FAILCRITICALERRORS => 1, SEM_NOGPFAULTERRORBOX => 2 };
 sub SetErrormode { }
diff --git a/src/tools/msvc/gendef.pl b/src/tools/msvc/gendef.pl
index cf83d7d056..593a8e005c 100644
--- a/src/tools/msvc/gendef.pl
+++ b/src/tools/msvc/gendef.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use List::Util qw(min);
 use Getopt::Long;
 
diff --git a/src/tools/msvc/install.pl b/src/tools/msvc/install.pl
index 8de7cee90f..37cb8d6b43 100755
--- a/src/tools/msvc/install.pl
+++ b/src/tools/msvc/install.pl
@@ -7,7 +7,7 @@
 # src/tools/msvc/install.pl
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib $FindBin::RealBin;
diff --git a/src/tools/msvc/mkvcbuild.pl b/src/tools/msvc/mkvcbuild.pl
index 7f94b1a6c9..b2f43fafeb 100644
--- a/src/tools/msvc/mkvcbuild.pl
+++ b/src/tools/msvc/mkvcbuild.pl
@@ -8,7 +8,7 @@
 # src/tools/msvc/mkvcbuild.pl
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib $FindBin::RealBin;
diff --git a/src/tools/msvc/pgbison.pl b/src/tools/msvc/pgbison.pl
index 25df6699b5..0687a5b874 100644
--- a/src/tools/msvc/pgbison.pl
+++ b/src/tools/msvc/pgbison.pl
@@ -5,7 +5,7 @@
 # src/tools/msvc/pgbison.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 
diff --git a/src/tools/msvc/pgflex.pl b/src/tools/msvc/pgflex.pl
index c308a08b55..59361d59c9 100644
--- a/src/tools/msvc/pgflex.pl
+++ b/src/tools/msvc/pgflex.pl
@@ -5,7 +5,7 @@
 # src/tools/msvc/pgflex.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 78170d105d..e8ea1a68dc 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -5,7 +5,7 @@
 # src/tools/msvc/vcregress.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 our $config;
 
diff --git a/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl b/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
index fef5c86ca4..fb772cb89b 100644
--- a/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
+++ b/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2017-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd qw(getcwd);
 use File::Copy "cp";
diff --git a/src/tools/pginclude/pgcheckdefines b/src/tools/pginclude/pgcheckdefines
index a9fe79ebe5..68aa5d178e 100755
--- a/src/tools/pginclude/pgcheckdefines
+++ b/src/tools/pginclude/pgcheckdefines
@@ -23,7 +23,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd;
 use File::Basename;
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index bce63d95da..b81fbab2ab 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd qw(abs_path getcwd);
 use File::Find;
diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl
index 1f0074ded5..ad0f233758 100755
--- a/src/tools/version_stamp.pl
+++ b/src/tools/version_stamp.pl
@@ -21,7 +21,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Major version is hard-wired into the script.  We update it when we branch
 # a new development version.
diff --git a/src/tools/win32tzlist.pl b/src/tools/win32tzlist.pl
index 657f7d4879..3a1ca4cb15 100755
--- a/src/tools/win32tzlist.pl
+++ b/src/tools/win32tzlist.pl
@@ -16,7 +16,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Win32::Registry;
 
-- 
2.41.0

#2Peter Eisentraut
peter@eisentraut.org
In reply to: Peter Eisentraut (#1)
2 attachment(s)
Re: Make all Perl warnings fatal

To avoid a complete bloodbath on cfbot, here is an updated patch set
that includes a workaround for the getprotobyname() issue mentioned below.

Show quoted text

On 10.08.23 07:58, Peter Eisentraut wrote:

We have a lot of Perl scripts in the tree, mostly code generation and
TAP tests.  Occasionally, these scripts produce warnings.  These are
AFAICT always mistakes on the developer side (true positives).  Typical
examples are warnings from genbki.pl or related when you make a mess in
the catalog files during development, or warnings from tests when they
massage a config file that looks different on different hosts, or
mistakes during merges (e.g., duplicate subroutine definitions), or just
mistakes that weren't noticed, because, you know, there is a lot of
output in a verbose build.

I wanted to figure put if we can catch these more reliably, in the style
of -Werror.  AFAICT, there is no way to automatically turn all warnings
into fatal errors.  But there is a way to do it per script, by replacing

    use warnings;

by

    use warnings FATAL => 'all';

See attached patch to try it out.

The documentation at <https://perldoc.perl.org/warnings#Fatal-Warnings&gt;
appears to sort of hand-wave against doing that.  Their argument appears
to be something like, the modules you use might in the future produce
additional warnings, thus breaking your scripts.  On balance, I'd take
that risk, if it means I would notice the warnings in a more timely and
robust way.  But that's just me at a moment in time.

Thoughts?

Now to some funny business.  If you apply this patch, the Cirrus CI
Linux tasks will fail, because they get an undefined return from
getprotobyname() in PostgreSQL/Test/Cluster.pm.  Huh?  I need this patch
to get past that:

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm 
b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 3fa679ff97..dfe7bc7b1a 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -1570,7 +1570,7 @@ sub can_bind
    my ($host, $port) = @_;
    my $iaddr = inet_aton($host);
    my $paddr = sockaddr_in($port, $iaddr);
-   my $proto = getprotobyname("tcp");
+   my $proto = getprotobyname("tcp") || 6;

    socket(SOCK, PF_INET, SOCK_STREAM, $proto)
      or die "socket failed: $!";

What is going on there?  Does this host not have /etc/protocols, or
something like that?

There are also a couple of issues in the MSVC legacy build system that
would need to be tightened up in order to survive with fatal Perl
warnings.  Obviously, there is a question whether it's worth spending
any time on that anymore.

Attachments:

v2-0001-Make-all-Perl-warnings-fatal.patchtext/plain; charset=UTF-8; name=v2-0001-Make-all-Perl-warnings-fatal.patchDownload
From 085446f8f50c567466fc885698b57155de237015 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 1 Aug 2023 13:44:16 +0200
Subject: [PATCH v2] Make all Perl warnings fatal

---
 config/check_modules.pl                                |  2 +-
 contrib/amcheck/t/001_verify_heapam.pl                 |  2 +-
 contrib/amcheck/t/002_cic.pl                           |  2 +-
 contrib/amcheck/t/003_cic_2pc.pl                       |  2 +-
 contrib/auto_explain/t/001_auto_explain.pl             |  2 +-
 contrib/basebackup_to_shell/t/001_basic.pl             |  2 +-
 contrib/bloom/t/001_wal.pl                             |  2 +-
 contrib/fuzzystrmatch/daitch_mokotoff_header.pl        |  2 +-
 contrib/intarray/bench/bench.pl                        |  2 +-
 contrib/intarray/bench/create_test.pl                  |  2 +-
 contrib/oid2name/t/001_basic.pl                        |  2 +-
 contrib/pg_prewarm/t/001_basic.pl                      |  2 +-
 contrib/seg/seg-validate.pl                            |  2 +-
 contrib/seg/sort-segments.pl                           |  2 +-
 contrib/test_decoding/t/001_repl_stats.pl              |  2 +-
 contrib/vacuumlo/t/001_basic.pl                        |  2 +-
 doc/src/sgml/generate-errcodes-table.pl                |  2 +-
 doc/src/sgml/generate-keywords-table.pl                |  2 +-
 doc/src/sgml/mk_feature_tables.pl                      |  2 +-
 src/backend/catalog/Catalog.pm                         |  2 +-
 src/backend/catalog/genbki.pl                          |  2 +-
 src/backend/nodes/gen_node_support.pl                  |  2 +-
 src/backend/parser/check_keywords.pl                   |  2 +-
 src/backend/snowball/snowball_create.pl                |  2 +-
 src/backend/storage/lmgr/generate-lwlocknames.pl       |  2 +-
 src/backend/utils/Gen_fmgrtab.pl                       |  2 +-
 .../utils/activity/generate-wait_event_types.pl        |  2 +-
 src/backend/utils/generate-errcodes.pl                 |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_BIG5.pl            |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl          |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl    |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl          |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl          |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl          |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_GB18030.pl         |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl           |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl  |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_SJIS.pl            |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_UHC.pl             |  2 +-
 src/backend/utils/mb/Unicode/UCS_to_most.pl            |  2 +-
 src/backend/utils/mb/Unicode/convutils.pm              |  2 +-
 src/bin/initdb/t/001_initdb.pl                         |  2 +-
 src/bin/pg_amcheck/t/001_basic.pl                      |  2 +-
 src/bin/pg_amcheck/t/002_nonesuch.pl                   |  2 +-
 src/bin/pg_amcheck/t/003_check.pl                      |  2 +-
 src/bin/pg_amcheck/t/004_verify_heapam.pl              |  2 +-
 src/bin/pg_amcheck/t/005_opclass_damage.pl             |  2 +-
 src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl   |  2 +-
 src/bin/pg_basebackup/t/010_pg_basebackup.pl           |  2 +-
 src/bin/pg_basebackup/t/011_in_place_tablespace.pl     |  2 +-
 src/bin/pg_basebackup/t/020_pg_receivewal.pl           |  2 +-
 src/bin/pg_basebackup/t/030_pg_recvlogical.pl          |  2 +-
 src/bin/pg_checksums/t/001_basic.pl                    |  2 +-
 src/bin/pg_checksums/t/002_actions.pl                  |  2 +-
 src/bin/pg_config/t/001_pg_config.pl                   |  2 +-
 src/bin/pg_controldata/t/001_pg_controldata.pl         |  2 +-
 src/bin/pg_ctl/t/001_start_stop.pl                     |  2 +-
 src/bin/pg_ctl/t/002_status.pl                         |  2 +-
 src/bin/pg_ctl/t/003_promote.pl                        |  2 +-
 src/bin/pg_ctl/t/004_logrotate.pl                      |  2 +-
 src/bin/pg_dump/t/001_basic.pl                         |  2 +-
 src/bin/pg_dump/t/002_pg_dump.pl                       |  2 +-
 src/bin/pg_dump/t/003_pg_dump_with_server.pl           |  2 +-
 src/bin/pg_dump/t/004_pg_dump_parallel.pl              |  2 +-
 src/bin/pg_dump/t/010_dump_connstr.pl                  |  2 +-
 src/bin/pg_resetwal/t/001_basic.pl                     |  2 +-
 src/bin/pg_resetwal/t/002_corrupted.pl                 |  2 +-
 src/bin/pg_rewind/t/001_basic.pl                       |  2 +-
 src/bin/pg_rewind/t/002_databases.pl                   |  2 +-
 src/bin/pg_rewind/t/003_extrafiles.pl                  |  2 +-
 src/bin/pg_rewind/t/004_pg_xlog_symlink.pl             |  2 +-
 src/bin/pg_rewind/t/005_same_timeline.pl               |  2 +-
 src/bin/pg_rewind/t/006_options.pl                     |  2 +-
 src/bin/pg_rewind/t/007_standby_source.pl              |  2 +-
 src/bin/pg_rewind/t/008_min_recovery_point.pl          |  2 +-
 src/bin/pg_rewind/t/009_growing_files.pl               |  2 +-
 src/bin/pg_rewind/t/RewindTest.pm                      |  2 +-
 src/bin/pg_test_fsync/t/001_basic.pl                   |  2 +-
 src/bin/pg_test_timing/t/001_basic.pl                  |  2 +-
 src/bin/pg_upgrade/t/001_basic.pl                      |  2 +-
 src/bin/pg_upgrade/t/002_pg_upgrade.pl                 |  2 +-
 src/bin/pg_verifybackup/t/001_basic.pl                 |  2 +-
 src/bin/pg_verifybackup/t/002_algorithm.pl             |  2 +-
 src/bin/pg_verifybackup/t/003_corruption.pl            |  2 +-
 src/bin/pg_verifybackup/t/004_options.pl               |  2 +-
 src/bin/pg_verifybackup/t/005_bad_manifest.pl          |  2 +-
 src/bin/pg_verifybackup/t/006_encoding.pl              |  2 +-
 src/bin/pg_verifybackup/t/007_wal.pl                   |  2 +-
 src/bin/pg_verifybackup/t/008_untar.pl                 |  2 +-
 src/bin/pg_verifybackup/t/009_extract.pl               |  2 +-
 src/bin/pg_verifybackup/t/010_client_untar.pl          |  2 +-
 src/bin/pg_waldump/t/001_basic.pl                      |  2 +-
 src/bin/pg_waldump/t/002_save_fullpage.pl              |  2 +-
 src/bin/pgbench/t/001_pgbench_with_server.pl           |  2 +-
 src/bin/pgbench/t/002_pgbench_no_server.pl             |  2 +-
 src/bin/psql/create_help.pl                            |  2 +-
 src/bin/psql/t/001_basic.pl                            |  2 +-
 src/bin/psql/t/010_tab_completion.pl                   |  2 +-
 src/bin/psql/t/020_cancel.pl                           |  2 +-
 src/bin/scripts/t/010_clusterdb.pl                     |  2 +-
 src/bin/scripts/t/011_clusterdb_all.pl                 |  2 +-
 src/bin/scripts/t/020_createdb.pl                      |  2 +-
 src/bin/scripts/t/040_createuser.pl                    |  2 +-
 src/bin/scripts/t/050_dropdb.pl                        |  2 +-
 src/bin/scripts/t/070_dropuser.pl                      |  2 +-
 src/bin/scripts/t/080_pg_isready.pl                    |  2 +-
 src/bin/scripts/t/090_reindexdb.pl                     |  2 +-
 src/bin/scripts/t/091_reindexdb_all.pl                 |  2 +-
 src/bin/scripts/t/100_vacuumdb.pl                      |  2 +-
 src/bin/scripts/t/101_vacuumdb_all.pl                  |  2 +-
 src/bin/scripts/t/102_vacuumdb_stages.pl               |  2 +-
 src/bin/scripts/t/200_connstr.pl                       |  2 +-
 src/common/unicode/generate-norm_test_table.pl         |  2 +-
 .../unicode/generate-unicode_east_asian_fw_table.pl    |  2 +-
 .../unicode/generate-unicode_nonspacing_table.pl       |  2 +-
 src/common/unicode/generate-unicode_norm_table.pl      |  2 +-
 src/common/unicode/generate-unicode_normprops_table.pl |  2 +-
 src/include/catalog/duplicate_oids                     |  2 +-
 src/include/catalog/reformat_dat_file.pl               |  2 +-
 src/include/catalog/renumber_oids.pl                   |  2 +-
 src/include/catalog/unused_oids                        |  2 +-
 src/interfaces/ecpg/preproc/check_rules.pl             |  2 +-
 src/interfaces/ecpg/preproc/parse.pl                   |  2 +-
 src/interfaces/libpq/t/001_uri.pl                      |  2 +-
 src/interfaces/libpq/t/002_api.pl                      |  2 +-
 src/interfaces/libpq/t/003_load_balance_host_list.pl   |  2 +-
 src/interfaces/libpq/t/004_load_balance_dns.pl         |  2 +-
 src/pl/plperl/plc_perlboot.pl                          |  6 +++---
 src/pl/plperl/plperl_opmask.pl                         |  2 +-
 src/pl/plperl/text2macro.pl                            |  2 +-
 src/pl/plpgsql/src/generate-plerrcodes.pl              |  2 +-
 src/pl/plpython/generate-spiexceptions.pl              |  2 +-
 src/pl/tcl/generate-pltclerrcodes.pl                   |  2 +-
 src/test/authentication/t/001_password.pl              |  2 +-
 src/test/authentication/t/002_saslprep.pl              |  2 +-
 src/test/authentication/t/003_peer.pl                  |  2 +-
 src/test/authentication/t/004_file_inclusion.pl        |  2 +-
 src/test/authentication/t/005_sspi.pl                  |  2 +-
 src/test/icu/t/010_database.pl                         |  2 +-
 src/test/kerberos/t/001_auth.pl                        |  2 +-
 src/test/ldap/LdapServer.pm                            |  2 +-
 src/test/ldap/t/001_auth.pl                            |  2 +-
 src/test/ldap/t/002_bindpasswd.pl                      |  2 +-
 src/test/locale/sort-test.pl                           |  2 +-
 src/test/modules/brin/t/01_workitems.pl                |  2 +-
 src/test/modules/brin/t/02_wal_consistency.pl          |  2 +-
 src/test/modules/commit_ts/t/001_base.pl               |  2 +-
 src/test/modules/commit_ts/t/002_standby.pl            |  2 +-
 src/test/modules/commit_ts/t/003_standby_2.pl          |  2 +-
 src/test/modules/commit_ts/t/004_restart.pl            |  2 +-
 .../ldap_password_func/t/001_mutated_bindpasswd.pl     |  2 +-
 .../modules/libpq_pipeline/t/001_libpq_pipeline.pl     |  2 +-
 .../modules/ssl_passphrase_callback/t/001_testfunc.pl  |  2 +-
 src/test/modules/test_custom_rmgrs/t/001_basic.pl      |  2 +-
 .../modules/test_misc/t/001_constraint_validation.pl   |  2 +-
 src/test/modules/test_misc/t/002_tablespace.pl         |  2 +-
 src/test/modules/test_misc/t/003_check_guc.pl          |  2 +-
 src/test/modules/test_misc/t/004_io_direct.pl          |  2 +-
 src/test/modules/test_pg_dump/t/001_base.pl            |  2 +-
 src/test/modules/worker_spi/t/001_worker_spi.pl        |  2 +-
 src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm         |  2 +-
 src/test/perl/PostgreSQL/Test/BackgroundPsql.pm        |  2 +-
 src/test/perl/PostgreSQL/Test/Cluster.pm               |  2 +-
 src/test/perl/PostgreSQL/Test/RecursiveCopy.pm         |  2 +-
 src/test/perl/PostgreSQL/Test/SimpleTee.pm             |  2 +-
 src/test/perl/PostgreSQL/Test/Utils.pm                 |  2 +-
 src/test/perl/PostgreSQL/Version.pm                    |  2 +-
 src/test/perl/README                                   |  2 +-
 src/test/recovery/t/001_stream_rep.pl                  |  2 +-
 src/test/recovery/t/002_archiving.pl                   |  2 +-
 src/test/recovery/t/003_recovery_targets.pl            |  2 +-
 src/test/recovery/t/004_timeline_switch.pl             |  2 +-
 src/test/recovery/t/005_replay_delay.pl                |  2 +-
 src/test/recovery/t/006_logical_decoding.pl            |  2 +-
 src/test/recovery/t/007_sync_rep.pl                    |  2 +-
 src/test/recovery/t/008_fsm_truncation.pl              |  2 +-
 src/test/recovery/t/009_twophase.pl                    |  2 +-
 src/test/recovery/t/010_logical_decoding_timelines.pl  |  2 +-
 src/test/recovery/t/012_subtransactions.pl             |  2 +-
 src/test/recovery/t/013_crash_restart.pl               |  2 +-
 src/test/recovery/t/014_unlogged_reinit.pl             |  2 +-
 src/test/recovery/t/015_promotion_pages.pl             |  2 +-
 src/test/recovery/t/016_min_consistency.pl             |  2 +-
 src/test/recovery/t/017_shm.pl                         |  2 +-
 src/test/recovery/t/018_wal_optimize.pl                |  2 +-
 src/test/recovery/t/019_replslot_limit.pl              |  2 +-
 src/test/recovery/t/020_archive_status.pl              |  2 +-
 src/test/recovery/t/021_row_visibility.pl              |  2 +-
 src/test/recovery/t/022_crash_temp_files.pl            |  2 +-
 src/test/recovery/t/023_pitr_prepared_xact.pl          |  2 +-
 src/test/recovery/t/024_archive_recovery.pl            |  2 +-
 src/test/recovery/t/025_stuck_on_old_timeline.pl       |  2 +-
 src/test/recovery/t/026_overwrite_contrecord.pl        |  2 +-
 src/test/recovery/t/027_stream_regress.pl              |  2 +-
 src/test/recovery/t/028_pitr_timelines.pl              |  2 +-
 src/test/recovery/t/029_stats_restart.pl               |  2 +-
 src/test/recovery/t/030_stats_cleanup_replica.pl       |  2 +-
 src/test/recovery/t/031_recovery_conflict.pl           |  2 +-
 src/test/recovery/t/032_relfilenode_reuse.pl           |  2 +-
 src/test/recovery/t/033_replay_tsp_drops.pl            |  2 +-
 src/test/recovery/t/034_create_database.pl             |  2 +-
 src/test/recovery/t/035_standby_logical_decoding.pl    |  2 +-
 src/test/recovery/t/036_truncated_dropped.pl           |  2 +-
 src/test/recovery/t/037_invalid_database.pl            |  2 +-
 src/test/recovery/t/cp_history_files                   |  2 +-
 src/test/ssl/t/001_ssltests.pl                         |  4 +++-
 src/test/ssl/t/002_scram.pl                            |  2 +-
 src/test/ssl/t/003_sslinfo.pl                          |  2 +-
 src/test/ssl/t/SSL/Backend/OpenSSL.pm                  |  2 +-
 src/test/ssl/t/SSL/Server.pm                           |  2 +-
 src/test/subscription/t/001_rep_changes.pl             |  2 +-
 src/test/subscription/t/002_types.pl                   |  2 +-
 src/test/subscription/t/003_constraints.pl             |  2 +-
 src/test/subscription/t/004_sync.pl                    |  2 +-
 src/test/subscription/t/005_encoding.pl                |  2 +-
 src/test/subscription/t/006_rewrite.pl                 |  2 +-
 src/test/subscription/t/007_ddl.pl                     |  2 +-
 src/test/subscription/t/008_diff_schema.pl             |  2 +-
 src/test/subscription/t/009_matviews.pl                |  2 +-
 src/test/subscription/t/010_truncate.pl                |  2 +-
 src/test/subscription/t/011_generated.pl               |  2 +-
 src/test/subscription/t/012_collation.pl               |  2 +-
 src/test/subscription/t/013_partition.pl               |  2 +-
 src/test/subscription/t/014_binary.pl                  |  2 +-
 src/test/subscription/t/015_stream.pl                  |  2 +-
 src/test/subscription/t/016_stream_subxact.pl          |  2 +-
 src/test/subscription/t/017_stream_ddl.pl              |  2 +-
 src/test/subscription/t/018_stream_subxact_abort.pl    |  2 +-
 .../subscription/t/019_stream_subxact_ddl_abort.pl     |  2 +-
 src/test/subscription/t/020_messages.pl                |  2 +-
 src/test/subscription/t/021_twophase.pl                |  2 +-
 src/test/subscription/t/022_twophase_cascade.pl        |  2 +-
 src/test/subscription/t/023_twophase_stream.pl         |  2 +-
 src/test/subscription/t/024_add_drop_pub.pl            |  2 +-
 src/test/subscription/t/025_rep_changes_for_schema.pl  |  2 +-
 src/test/subscription/t/026_stats.pl                   |  2 +-
 src/test/subscription/t/027_nosuperuser.pl             |  2 +-
 src/test/subscription/t/028_row_filter.pl              |  2 +-
 src/test/subscription/t/029_on_error.pl                |  2 +-
 src/test/subscription/t/030_origin.pl                  |  2 +-
 src/test/subscription/t/031_column_list.pl             |  2 +-
 src/test/subscription/t/032_subscribe_use_index.pl     |  2 +-
 src/test/subscription/t/033_run_as_table_owner.pl      |  2 +-
 src/test/subscription/t/100_bugs.pl                    |  2 +-
 src/tools/PerfectHash.pm                               |  2 +-
 src/tools/check_bison_recursion.pl                     |  2 +-
 src/tools/ci/windows_build_config.pl                   |  2 +-
 src/tools/copyright.pl                                 |  2 +-
 src/tools/fix-old-flex-code.pl                         |  2 +-
 src/tools/gen_export.pl                                |  2 +-
 src/tools/gen_keywordlist.pl                           |  2 +-
 src/tools/git_changelog                                |  2 +-
 src/tools/mark_pgdllimport.pl                          |  2 +-
 src/tools/msvc/Install.pm                              |  2 +-
 src/tools/msvc/MSBuildProject.pm                       | 10 +++++-----
 src/tools/msvc/Mkvcbuild.pm                            |  2 +-
 src/tools/msvc/Project.pm                              |  2 +-
 src/tools/msvc/Solution.pm                             | 10 +++++-----
 src/tools/msvc/VSObjectFactory.pm                      |  2 +-
 src/tools/msvc/build.pl                                |  2 +-
 src/tools/msvc/config_default.pl                       |  2 +-
 src/tools/msvc/dummylib/Win32.pm                       |  2 +-
 src/tools/msvc/dummylib/Win32/Registry.pm              |  2 +-
 src/tools/msvc/dummylib/Win32API/File.pm               |  2 +-
 src/tools/msvc/gendef.pl                               |  2 +-
 src/tools/msvc/install.pl                              |  2 +-
 src/tools/msvc/mkvcbuild.pl                            |  2 +-
 src/tools/msvc/pgbison.pl                              |  2 +-
 src/tools/msvc/pgflex.pl                               |  2 +-
 src/tools/msvc/vcregress.pl                            |  2 +-
 src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl         |  2 +-
 src/tools/pginclude/pgcheckdefines                     |  2 +-
 src/tools/pgindent/pgindent                            |  2 +-
 src/tools/version_stamp.pl                             |  2 +-
 src/tools/win32tzlist.pl                               |  2 +-
 275 files changed, 287 insertions(+), 285 deletions(-)

diff --git a/config/check_modules.pl b/config/check_modules.pl
index 611f3a673f..1599abcc0b 100644
--- a/config/check_modules.pl
+++ b/config/check_modules.pl
@@ -5,7 +5,7 @@
 # but specify them anyway for documentation's sake.)
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config;
 
 use IPC::Run 0.79;
diff --git a/contrib/amcheck/t/001_verify_heapam.pl b/contrib/amcheck/t/001_verify_heapam.pl
index 46d5b53181..c9caa48169 100644
--- a/contrib/amcheck/t/001_verify_heapam.pl
+++ b/contrib/amcheck/t/001_verify_heapam.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/amcheck/t/002_cic.pl b/contrib/amcheck/t/002_cic.pl
index 42a047a357..f0b5d8f7e4 100644
--- a/contrib/amcheck/t/002_cic.pl
+++ b/contrib/amcheck/t/002_cic.pl
@@ -3,7 +3,7 @@
 
 # Test CREATE INDEX CONCURRENTLY with concurrent modifications
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/amcheck/t/003_cic_2pc.pl b/contrib/amcheck/t/003_cic_2pc.pl
index 3279a2505a..a5eb2d9d69 100644
--- a/contrib/amcheck/t/003_cic_2pc.pl
+++ b/contrib/amcheck/t/003_cic_2pc.pl
@@ -3,7 +3,7 @@
 
 # Test CREATE INDEX CONCURRENTLY with concurrent prepared-xact modifications
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/auto_explain/t/001_auto_explain.pl b/contrib/auto_explain/t/001_auto_explain.pl
index abb422f8de..2720215dbc 100644
--- a/contrib/auto_explain/t/001_auto_explain.pl
+++ b/contrib/auto_explain/t/001_auto_explain.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/basebackup_to_shell/t/001_basic.pl b/contrib/basebackup_to_shell/t/001_basic.pl
index e2cdd2ecb0..221f5b2296 100644
--- a/contrib/basebackup_to_shell/t/001_basic.pl
+++ b/contrib/basebackup_to_shell/t/001_basic.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/bloom/t/001_wal.pl b/contrib/bloom/t/001_wal.pl
index 2a69ff1a74..7e8c2b1a3d 100644
--- a/contrib/bloom/t/001_wal.pl
+++ b/contrib/bloom/t/001_wal.pl
@@ -3,7 +3,7 @@
 
 # Test generic xlog record work for bloom index replication.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/contrib/fuzzystrmatch/daitch_mokotoff_header.pl b/contrib/fuzzystrmatch/daitch_mokotoff_header.pl
index 51a40e7748..5ee0d1cc7c 100755
--- a/contrib/fuzzystrmatch/daitch_mokotoff_header.pl
+++ b/contrib/fuzzystrmatch/daitch_mokotoff_header.pl
@@ -9,7 +9,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 die "Usage: $0 OUTPUT_FILE\n" if @ARGV != 1;
 my $output_file = $ARGV[0];
diff --git a/contrib/intarray/bench/bench.pl b/contrib/intarray/bench/bench.pl
index 067654986e..ba8163ce11 100755
--- a/contrib/intarray/bench/bench.pl
+++ b/contrib/intarray/bench/bench.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # make sure we are in a sane environment.
 use DBI();
diff --git a/contrib/intarray/bench/create_test.pl b/contrib/intarray/bench/create_test.pl
index 6efe9151ca..f6ffc5b452 100755
--- a/contrib/intarray/bench/create_test.pl
+++ b/contrib/intarray/bench/create_test.pl
@@ -5,7 +5,7 @@
 # contrib/intarray/bench/create_test.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print <<EOT;
 create table message (
diff --git a/contrib/oid2name/t/001_basic.pl b/contrib/oid2name/t/001_basic.pl
index 74fe622916..ac361a0139 100644
--- a/contrib/oid2name/t/001_basic.pl
+++ b/contrib/oid2name/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/contrib/pg_prewarm/t/001_basic.pl b/contrib/pg_prewarm/t/001_basic.pl
index 6b7c869afc..b2f86c1a25 100644
--- a/contrib/pg_prewarm/t/001_basic.pl
+++ b/contrib/pg_prewarm/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/seg/seg-validate.pl b/contrib/seg/seg-validate.pl
index 67c0015e6b..b21af13140 100755
--- a/contrib/seg/seg-validate.pl
+++ b/contrib/seg/seg-validate.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $integer = '[+-]?[0-9]+';
 my $real = '[+-]?[0-9]+\.[0-9]+';
diff --git a/contrib/seg/sort-segments.pl b/contrib/seg/sort-segments.pl
index 3cc21a3ba0..9bd71c0391 100755
--- a/contrib/seg/sort-segments.pl
+++ b/contrib/seg/sort-segments.pl
@@ -5,7 +5,7 @@
 # this script will sort any table with the segment data type in its last column
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my @rows;
 
diff --git a/contrib/test_decoding/t/001_repl_stats.pl b/contrib/test_decoding/t/001_repl_stats.pl
index 7c2d87561c..da466bdacf 100644
--- a/contrib/test_decoding/t/001_repl_stats.pl
+++ b/contrib/test_decoding/t/001_repl_stats.pl
@@ -4,7 +4,7 @@
 # Test replication statistics data in pg_stat_replication_slots is sane after
 # drop replication slot and restart.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/vacuumlo/t/001_basic.pl b/contrib/vacuumlo/t/001_basic.pl
index 75067863de..4e6566d86b 100644
--- a/contrib/vacuumlo/t/001_basic.pl
+++ b/contrib/vacuumlo/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/doc/src/sgml/generate-errcodes-table.pl b/doc/src/sgml/generate-errcodes-table.pl
index 51f22bde95..e4df6d9ece 100644
--- a/doc/src/sgml/generate-errcodes-table.pl
+++ b/doc/src/sgml/generate-errcodes-table.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "<!-- autogenerated from src/backend/utils/errcodes.txt, do not edit -->\n";
diff --git a/doc/src/sgml/generate-keywords-table.pl b/doc/src/sgml/generate-keywords-table.pl
index ee44edaa6c..145d131670 100644
--- a/doc/src/sgml/generate-keywords-table.pl
+++ b/doc/src/sgml/generate-keywords-table.pl
@@ -5,7 +5,7 @@
 # Copyright (c) 2019-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my @sql_versions = reverse sort ('1992', '2016', '2023');
 
diff --git a/doc/src/sgml/mk_feature_tables.pl b/doc/src/sgml/mk_feature_tables.pl
index 824be729a0..69b1d3a1a7 100644
--- a/doc/src/sgml/mk_feature_tables.pl
+++ b/doc/src/sgml/mk_feature_tables.pl
@@ -3,7 +3,7 @@
 # doc/src/sgml/mk_feature_tables.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $yesno = $ARGV[0];
 
diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index b15f513183..4f1e9b5181 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -14,7 +14,7 @@
 package Catalog;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Compare;
 
diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index 4a7205472c..dc6f13a89b 100644
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -14,7 +14,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/backend/nodes/gen_node_support.pl b/src/backend/nodes/gen_node_support.pl
index 72c7963578..c7091d6bf2 100644
--- a/src/backend/nodes/gen_node_support.pl
+++ b/src/backend/nodes/gen_node_support.pl
@@ -16,7 +16,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 use Getopt::Long;
diff --git a/src/backend/parser/check_keywords.pl b/src/backend/parser/check_keywords.pl
index e9b6f40eaa..cc58ce88a9 100644
--- a/src/backend/parser/check_keywords.pl
+++ b/src/backend/parser/check_keywords.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2009-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $gram_filename = $ARGV[0];
 my $kwlist_filename = $ARGV[1];
diff --git a/src/backend/snowball/snowball_create.pl b/src/backend/snowball/snowball_create.pl
index 35d1cd9621..f1c5d160de 100644
--- a/src/backend/snowball/snowball_create.pl
+++ b/src/backend/snowball/snowball_create.pl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $outdir_path = '';
diff --git a/src/backend/storage/lmgr/generate-lwlocknames.pl b/src/backend/storage/lmgr/generate-lwlocknames.pl
index 863c88252b..34bac0faf5 100644
--- a/src/backend/storage/lmgr/generate-lwlocknames.pl
+++ b/src/backend/storage/lmgr/generate-lwlocknames.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $output_path = '.';
diff --git a/src/backend/utils/Gen_fmgrtab.pl b/src/backend/utils/Gen_fmgrtab.pl
index 764216c56d..d0f3652136 100644
--- a/src/backend/utils/Gen_fmgrtab.pl
+++ b/src/backend/utils/Gen_fmgrtab.pl
@@ -17,7 +17,7 @@
 use Catalog;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $output_path = '';
diff --git a/src/backend/utils/activity/generate-wait_event_types.pl b/src/backend/utils/activity/generate-wait_event_types.pl
index 23eb3b1f57..8d9fd2e03f 100644
--- a/src/backend/utils/activity/generate-wait_event_types.pl
+++ b/src/backend/utils/activity/generate-wait_event_types.pl
@@ -15,7 +15,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $output_path = '.';
diff --git a/src/backend/utils/generate-errcodes.pl b/src/backend/utils/generate-errcodes.pl
index 34d0f25c23..42730e8c1a 100644
--- a/src/backend/utils/generate-errcodes.pl
+++ b/src/backend/utils/generate-errcodes.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $outfile = '';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl b/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
index 4c5724b8b7..41fe881e1b 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
@@ -25,7 +25,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
index f9ff2bd3d2..a14e4ac820 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
@@ -14,7 +14,7 @@
 # and the "b" field is the hex byte sequence for GB18030
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
index 2d0e05fb79..4b77ecc694 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
@@ -8,7 +8,7 @@
 # "euc-jis-2004-std.txt" (http://x0213.org)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
index 4073578027..41c825dbe7 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
@@ -12,7 +12,7 @@
 # organization's ftp site.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
index 9112e1cfe9..ff2a644012 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
@@ -17,7 +17,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
index 4ad17064ab..d2a3dac589 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
@@ -18,7 +18,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
index 9c8a983bf7..88c9c374b2 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
@@ -14,7 +14,7 @@
 # and the "b" field is the hex byte sequence for GB18030
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl b/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
index f50baa8f1f..decf8ab443 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
@@ -16,7 +16,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
index ed010a58fa..eb57ca89c5 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
@@ -8,7 +8,7 @@
 # "sjis-0213-2004-std.txt" (http://x0213.org)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
index 0808c6836b..3ef8960ade 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
@@ -11,7 +11,7 @@
 # ftp site.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_UHC.pl b/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
index 207677d76d..cc8b7d804c 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
@@ -14,7 +14,7 @@
 # and the "b" field is the hex byte sequence for UHC
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_most.pl b/src/backend/utils/mb/Unicode/UCS_to_most.pl
index a1947308ff..2a095b7d7d 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_most.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_most.pl
@@ -16,7 +16,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/convutils.pm b/src/backend/utils/mb/Unicode/convutils.pm
index 77de7b1a4d..0f55d9621b 100644
--- a/src/backend/utils/mb/Unicode/convutils.pm
+++ b/src/backend/utils/mb/Unicode/convutils.pm
@@ -6,7 +6,7 @@
 package convutils;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Exporter 'import';
diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl
index 2d7469d2fc..407ca92968 100644
--- a/src/bin/initdb/t/001_initdb.pl
+++ b/src/bin/initdb/t/001_initdb.pl
@@ -6,7 +6,7 @@
 # Successful initdb consumes much time and I/O.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Fcntl ':mode';
 use File::stat qw{lstat};
 use PostgreSQL::Test::Cluster;
diff --git a/src/bin/pg_amcheck/t/001_basic.pl b/src/bin/pg_amcheck/t/001_basic.pl
index 1f1e33278b..9737d965aa 100644
--- a/src/bin/pg_amcheck/t/001_basic.pl
+++ b/src/bin/pg_amcheck/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_amcheck/t/002_nonesuch.pl b/src/bin/pg_amcheck/t/002_nonesuch.pl
index 99b94dd022..df7ff5397a 100644
--- a/src/bin/pg_amcheck/t/002_nonesuch.pl
+++ b/src/bin/pg_amcheck/t/002_nonesuch.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_amcheck/t/003_check.pl b/src/bin/pg_amcheck/t/003_check.pl
index d577cffa30..3727906f98 100644
--- a/src/bin/pg_amcheck/t/003_check.pl
+++ b/src/bin/pg_amcheck/t/003_check.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_amcheck/t/004_verify_heapam.pl b/src/bin/pg_amcheck/t/004_verify_heapam.pl
index 1b5027c420..0f57adabe6 100644
--- a/src/bin/pg_amcheck/t/004_verify_heapam.pl
+++ b/src/bin/pg_amcheck/t/004_verify_heapam.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_amcheck/t/005_opclass_damage.pl b/src/bin/pg_amcheck/t/005_opclass_damage.pl
index fd476179f4..f2ea5fed40 100644
--- a/src/bin/pg_amcheck/t/005_opclass_damage.pl
+++ b/src/bin/pg_amcheck/t/005_opclass_damage.pl
@@ -5,7 +5,7 @@
 # presence of breaking sort order changes.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
index 18a82ff002..279c438345 100644
--- a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
+++ b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index b9f5e1266b..c4c197ae1a 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename qw(basename dirname);
 use File::Path     qw(rmtree);
 use PostgreSQL::Test::Cluster;
diff --git a/src/bin/pg_basebackup/t/011_in_place_tablespace.pl b/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
index d58696e8f9..da7154362e 100644
--- a/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
+++ b/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_basebackup/t/020_pg_receivewal.pl b/src/bin/pg_basebackup/t/020_pg_receivewal.pl
index 374f090a8b..765049ee96 100644
--- a/src/bin/pg_basebackup/t/020_pg_receivewal.pl
+++ b/src/bin/pg_basebackup/t/020_pg_receivewal.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
index 62dca5b67a..1bbe88da14 100644
--- a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
+++ b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/pg_checksums/t/001_basic.pl b/src/bin/pg_checksums/t/001_basic.pl
index d3601a5dd8..cfc147b77c 100644
--- a/src/bin/pg_checksums/t/001_basic.pl
+++ b/src/bin/pg_checksums/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.pl
index 2d63182d59..207dc8ec9c 100644
--- a/src/bin/pg_checksums/t/002_actions.pl
+++ b/src/bin/pg_checksums/t/002_actions.pl
@@ -5,7 +5,7 @@
 # an initialized cluster.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 
diff --git a/src/bin/pg_config/t/001_pg_config.pl b/src/bin/pg_config/t/001_pg_config.pl
index 24acf7872b..693f7be054 100644
--- a/src/bin/pg_config/t/001_pg_config.pl
+++ b/src/bin/pg_config/t/001_pg_config.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_controldata/t/001_pg_controldata.pl b/src/bin/pg_controldata/t/001_pg_controldata.pl
index 0c641036e9..eed301030e 100644
--- a/src/bin/pg_controldata/t/001_pg_controldata.pl
+++ b/src/bin/pg_controldata/t/001_pg_controldata.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index f019fe1703..e072916dfa 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_ctl/t/002_status.pl b/src/bin/pg_ctl/t/002_status.pl
index f5c50f6a7d..95bba696a4 100644
--- a/src/bin/pg_ctl/t/002_status.pl
+++ b/src/bin/pg_ctl/t/002_status.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_ctl/t/003_promote.pl b/src/bin/pg_ctl/t/003_promote.pl
index 0e83933098..f38e02f4a2 100644
--- a/src/bin/pg_ctl/t/003_promote.pl
+++ b/src/bin/pg_ctl/t/003_promote.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_ctl/t/004_logrotate.pl b/src/bin/pg_ctl/t/004_logrotate.pl
index 8d48e56ee9..912d89b5d6 100644
--- a/src/bin/pg_ctl/t/004_logrotate.pl
+++ b/src/bin/pg_ctl/t/004_logrotate.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/001_basic.pl b/src/bin/pg_dump/t/001_basic.pl
index 8c63d31cb6..60f0e1de45 100644
--- a/src/bin/pg_dump/t/001_basic.pl
+++ b/src/bin/pg_dump/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 6ad8310287..7935d1d3e5 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/003_pg_dump_with_server.pl b/src/bin/pg_dump/t/003_pg_dump_with_server.pl
index ab025c44a4..e21de45ba2 100644
--- a/src/bin/pg_dump/t/003_pg_dump_with_server.pl
+++ b/src/bin/pg_dump/t/003_pg_dump_with_server.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/004_pg_dump_parallel.pl b/src/bin/pg_dump/t/004_pg_dump_parallel.pl
index c4b461ed87..c14391f58b 100644
--- a/src/bin/pg_dump/t/004_pg_dump_parallel.pl
+++ b/src/bin/pg_dump/t/004_pg_dump_parallel.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/010_dump_connstr.pl b/src/bin/pg_dump/t/010_dump_connstr.pl
index ed86c332ef..f03e1e08cc 100644
--- a/src/bin/pg_dump/t/010_dump_connstr.pl
+++ b/src/bin/pg_dump/t/010_dump_connstr.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_resetwal/t/001_basic.pl b/src/bin/pg_resetwal/t/001_basic.pl
index 7e5efbf56b..5c2c5908e9 100644
--- a/src/bin/pg_resetwal/t/001_basic.pl
+++ b/src/bin/pg_resetwal/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_resetwal/t/002_corrupted.pl b/src/bin/pg_resetwal/t/002_corrupted.pl
index 6d19a1efd5..7cc42d70eb 100644
--- a/src/bin/pg_resetwal/t/002_corrupted.pl
+++ b/src/bin/pg_resetwal/t/002_corrupted.pl
@@ -4,7 +4,7 @@
 # Tests for handling a corrupted pg_control
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_rewind/t/001_basic.pl b/src/bin/pg_rewind/t/001_basic.pl
index c7b48255a7..842f6c7fbe 100644
--- a/src/bin/pg_rewind/t/001_basic.pl
+++ b/src/bin/pg_rewind/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/002_databases.pl b/src/bin/pg_rewind/t/002_databases.pl
index 0d480aedb4..313b2486e1 100644
--- a/src/bin/pg_rewind/t/002_databases.pl
+++ b/src/bin/pg_rewind/t/002_databases.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/003_extrafiles.pl b/src/bin/pg_rewind/t/003_extrafiles.pl
index fd2bee5d20..6e040239c4 100644
--- a/src/bin/pg_rewind/t/003_extrafiles.pl
+++ b/src/bin/pg_rewind/t/003_extrafiles.pl
@@ -4,7 +4,7 @@
 # Test how pg_rewind reacts to extra files and directories in the data dirs.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index 5fb7fa9077..7d1bb65cae 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -5,7 +5,7 @@
 # Test pg_rewind when the target's pg_wal directory is a symlink.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Copy;
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_rewind/t/005_same_timeline.pl b/src/bin/pg_rewind/t/005_same_timeline.pl
index b4ef05e560..57e04b0ce2 100644
--- a/src/bin/pg_rewind/t/005_same_timeline.pl
+++ b/src/bin/pg_rewind/t/005_same_timeline.pl
@@ -6,7 +6,7 @@
 # on the same timeline runs successfully.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/006_options.pl b/src/bin/pg_rewind/t/006_options.pl
index 4b6e39a47c..c346b370a6 100644
--- a/src/bin/pg_rewind/t/006_options.pl
+++ b/src/bin/pg_rewind/t/006_options.pl
@@ -5,7 +5,7 @@
 # Test checking options of pg_rewind.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/007_standby_source.pl b/src/bin/pg_rewind/t/007_standby_source.pl
index 4fd1ed001c..fab84a4bbb 100644
--- a/src/bin/pg_rewind/t/007_standby_source.pl
+++ b/src/bin/pg_rewind/t/007_standby_source.pl
@@ -25,7 +25,7 @@
 # as is.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/008_min_recovery_point.pl b/src/bin/pg_rewind/t/008_min_recovery_point.pl
index d4c89451e6..287e4555b5 100644
--- a/src/bin/pg_rewind/t/008_min_recovery_point.pl
+++ b/src/bin/pg_rewind/t/008_min_recovery_point.pl
@@ -31,7 +31,7 @@
 # nodes.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_rewind/t/009_growing_files.pl b/src/bin/pg_rewind/t/009_growing_files.pl
index cf60a04ae7..016f7736e7 100644
--- a/src/bin/pg_rewind/t/009_growing_files.pl
+++ b/src/bin/pg_rewind/t/009_growing_files.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm
index 8fbbd521cb..23144f19e8 100644
--- a/src/bin/pg_rewind/t/RewindTest.pm
+++ b/src/bin/pg_rewind/t/RewindTest.pm
@@ -32,7 +32,7 @@ package RewindTest;
 # to run psql against the primary and standby servers, respectively.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Exporter 'import';
diff --git a/src/bin/pg_test_fsync/t/001_basic.pl b/src/bin/pg_test_fsync/t/001_basic.pl
index 401ad2c07c..135e68b9ba 100644
--- a/src/bin/pg_test_fsync/t/001_basic.pl
+++ b/src/bin/pg_test_fsync/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_test_timing/t/001_basic.pl b/src/bin/pg_test_timing/t/001_basic.pl
index 43bc68cb37..628a603f85 100644
--- a/src/bin/pg_test_timing/t/001_basic.pl
+++ b/src/bin/pg_test_timing/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_upgrade/t/001_basic.pl b/src/bin/pg_upgrade/t/001_basic.pl
index ceac4e0851..6f7117cec6 100644
--- a/src/bin/pg_upgrade/t/001_basic.pl
+++ b/src/bin/pg_upgrade/t/001_basic.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index a5688a1cf2..a484064b54 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -2,7 +2,7 @@
 
 # Set of tests for pg_upgrade, including cross-version checks.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd            qw(abs_path);
 use File::Basename qw(dirname);
diff --git a/src/bin/pg_verifybackup/t/001_basic.pl b/src/bin/pg_verifybackup/t/001_basic.pl
index 73e8663238..f1127c827a 100644
--- a/src/bin/pg_verifybackup/t/001_basic.pl
+++ b/src/bin/pg_verifybackup/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_verifybackup/t/002_algorithm.pl b/src/bin/pg_verifybackup/t/002_algorithm.pl
index 5b02ea4d55..c9f0c10f83 100644
--- a/src/bin/pg_verifybackup/t/002_algorithm.pl
+++ b/src/bin/pg_verifybackup/t/002_algorithm.pl
@@ -4,7 +4,7 @@
 # Verify that we can take and verify backups with various checksum types.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/003_corruption.pl b/src/bin/pg_verifybackup/t/003_corruption.pl
index 4cc3dd05e3..273a6ff77b 100644
--- a/src/bin/pg_verifybackup/t/003_corruption.pl
+++ b/src/bin/pg_verifybackup/t/003_corruption.pl
@@ -4,7 +4,7 @@
 # Verify that various forms of corruption are detected by pg_verifybackup.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/004_options.pl b/src/bin/pg_verifybackup/t/004_options.pl
index 2aa8352f00..f6b092b58a 100644
--- a/src/bin/pg_verifybackup/t/004_options.pl
+++ b/src/bin/pg_verifybackup/t/004_options.pl
@@ -4,7 +4,7 @@
 # Verify the behavior of assorted pg_verifybackup options.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/005_bad_manifest.pl b/src/bin/pg_verifybackup/t/005_bad_manifest.pl
index c94fdd5df8..d481ea1f02 100644
--- a/src/bin/pg_verifybackup/t/005_bad_manifest.pl
+++ b/src/bin/pg_verifybackup/t/005_bad_manifest.pl
@@ -5,7 +5,7 @@
 # problems.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_verifybackup/t/006_encoding.pl b/src/bin/pg_verifybackup/t/006_encoding.pl
index 0b37bda20c..3831a28272 100644
--- a/src/bin/pg_verifybackup/t/006_encoding.pl
+++ b/src/bin/pg_verifybackup/t/006_encoding.pl
@@ -4,7 +4,7 @@
 # Verify that pg_verifybackup handles hex-encoded filenames correctly.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_verifybackup/t/007_wal.pl b/src/bin/pg_verifybackup/t/007_wal.pl
index 89f96f85db..ea3d60b242 100644
--- a/src/bin/pg_verifybackup/t/007_wal.pl
+++ b/src/bin/pg_verifybackup/t/007_wal.pl
@@ -4,7 +4,7 @@
 # Test pg_verifybackup's WAL verification.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_verifybackup/t/008_untar.pl b/src/bin/pg_verifybackup/t/008_untar.pl
index 1a783d1188..7f0f2245f6 100644
--- a/src/bin/pg_verifybackup/t/008_untar.pl
+++ b/src/bin/pg_verifybackup/t/008_untar.pl
@@ -6,7 +6,7 @@
 # format.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/009_extract.pl b/src/bin/pg_verifybackup/t/009_extract.pl
index f4d5378555..e8e4f60768 100644
--- a/src/bin/pg_verifybackup/t/009_extract.pl
+++ b/src/bin/pg_verifybackup/t/009_extract.pl
@@ -5,7 +5,7 @@
 # a backup which was compressed by the server.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/010_client_untar.pl b/src/bin/pg_verifybackup/t/010_client_untar.pl
index 44d83e777f..64907f0cae 100644
--- a/src/bin/pg_verifybackup/t/010_client_untar.pl
+++ b/src/bin/pg_verifybackup/t/010_client_untar.pl
@@ -5,7 +5,7 @@
 # backup that didn't start out in plain format.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_waldump/t/001_basic.pl b/src/bin/pg_waldump/t/001_basic.pl
index 029a0d0521..b805283385 100644
--- a/src/bin/pg_waldump/t/001_basic.pl
+++ b/src/bin/pg_waldump/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_waldump/t/002_save_fullpage.pl b/src/bin/pg_waldump/t/002_save_fullpage.pl
index f0725805f2..ed6726c486 100644
--- a/src/bin/pg_waldump/t/002_save_fullpage.pl
+++ b/src/bin/pg_waldump/t/002_save_fullpage.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename;
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::RecursiveCopy;
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl
index 142f966300..3f4d2fec7c 100644
--- a/src/bin/pgbench/t/001_pgbench_with_server.pl
+++ b/src/bin/pgbench/t/001_pgbench_with_server.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pgbench/t/002_pgbench_no_server.pl b/src/bin/pgbench/t/002_pgbench_no_server.pl
index 0ec54fbb03..1596b256dd 100644
--- a/src/bin/pgbench/t/002_pgbench_no_server.pl
+++ b/src/bin/pgbench/t/002_pgbench_no_server.pl
@@ -6,7 +6,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/psql/create_help.pl b/src/bin/psql/create_help.pl
index 0809db4151..def02465d5 100644
--- a/src/bin/psql/create_help.pl
+++ b/src/bin/psql/create_help.pl
@@ -20,7 +20,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $docdir = '';
diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl
index 9ac27db212..b7bc73a197 100644
--- a/src/bin/psql/t/001_basic.pl
+++ b/src/bin/psql/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use locale;
 
 use PostgreSQL::Test::Cluster;
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl
index 4cd0fa4680..44fdd056fa 100644
--- a/src/bin/psql/t/010_tab_completion.pl
+++ b/src/bin/psql/t/010_tab_completion.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/psql/t/020_cancel.pl b/src/bin/psql/t/020_cancel.pl
index 0765d82b92..7b51b77075 100644
--- a/src/bin/psql/t/020_cancel.pl
+++ b/src/bin/psql/t/020_cancel.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/010_clusterdb.pl b/src/bin/scripts/t/010_clusterdb.pl
index 715207fb4d..60792c2eea 100644
--- a/src/bin/scripts/t/010_clusterdb.pl
+++ b/src/bin/scripts/t/010_clusterdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/011_clusterdb_all.pl b/src/bin/scripts/t/011_clusterdb_all.pl
index 35f0b18f50..26315d0a51 100644
--- a/src/bin/scripts/t/011_clusterdb_all.pl
+++ b/src/bin/scripts/t/011_clusterdb_all.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl
index 40291924e5..8815477672 100644
--- a/src/bin/scripts/t/020_createdb.pl
+++ b/src/bin/scripts/t/020_createdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/040_createuser.pl b/src/bin/scripts/t/040_createuser.pl
index 3290e30c88..75dd7331ba 100644
--- a/src/bin/scripts/t/040_createuser.pl
+++ b/src/bin/scripts/t/040_createuser.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/050_dropdb.pl b/src/bin/scripts/t/050_dropdb.pl
index 3ed670bb0a..e5acab9a38 100644
--- a/src/bin/scripts/t/050_dropdb.pl
+++ b/src/bin/scripts/t/050_dropdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/070_dropuser.pl b/src/bin/scripts/t/070_dropuser.pl
index 95c24c4f30..74947e8ca7 100644
--- a/src/bin/scripts/t/070_dropuser.pl
+++ b/src/bin/scripts/t/070_dropuser.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/080_pg_isready.pl b/src/bin/scripts/t/080_pg_isready.pl
index 8f53aef573..9784006465 100644
--- a/src/bin/scripts/t/080_pg_isready.pl
+++ b/src/bin/scripts/t/080_pg_isready.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl
index b663d0e741..7ed71849c3 100644
--- a/src/bin/scripts/t/090_reindexdb.pl
+++ b/src/bin/scripts/t/090_reindexdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/091_reindexdb_all.pl b/src/bin/scripts/t/091_reindexdb_all.pl
index 7f3e081ceb..fdb198b4e7 100644
--- a/src/bin/scripts/t/091_reindexdb_all.pl
+++ b/src/bin/scripts/t/091_reindexdb_all.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl
index eccfcc54a1..17f911efa2 100644
--- a/src/bin/scripts/t/100_vacuumdb.pl
+++ b/src/bin/scripts/t/100_vacuumdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/101_vacuumdb_all.pl b/src/bin/scripts/t/101_vacuumdb_all.pl
index 8d7c3ab014..673a94d005 100644
--- a/src/bin/scripts/t/101_vacuumdb_all.pl
+++ b/src/bin/scripts/t/101_vacuumdb_all.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/scripts/t/102_vacuumdb_stages.pl b/src/bin/scripts/t/102_vacuumdb_stages.pl
index 64d7ed1575..c1174fd5e8 100644
--- a/src/bin/scripts/t/102_vacuumdb_stages.pl
+++ b/src/bin/scripts/t/102_vacuumdb_stages.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/scripts/t/200_connstr.pl b/src/bin/scripts/t/200_connstr.pl
index 53c5e21ab2..4f3d9ffe98 100644
--- a/src/bin/scripts/t/200_connstr.pl
+++ b/src/bin/scripts/t/200_connstr.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/common/unicode/generate-norm_test_table.pl b/src/common/unicode/generate-norm_test_table.pl
index 3434f7e263..fb1718047f 100644
--- a/src/common/unicode/generate-norm_test_table.pl
+++ b/src/common/unicode/generate-norm_test_table.pl
@@ -8,7 +8,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 
diff --git a/src/common/unicode/generate-unicode_east_asian_fw_table.pl b/src/common/unicode/generate-unicode_east_asian_fw_table.pl
index 2b2df375ed..6037fdae2c 100644
--- a/src/common/unicode/generate-unicode_east_asian_fw_table.pl
+++ b/src/common/unicode/generate-unicode_east_asian_fw_table.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2019-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $range_start = undef;
 my ($first, $last);
diff --git a/src/common/unicode/generate-unicode_nonspacing_table.pl b/src/common/unicode/generate-unicode_nonspacing_table.pl
index ae86e82922..521b939943 100644
--- a/src/common/unicode/generate-unicode_nonspacing_table.pl
+++ b/src/common/unicode/generate-unicode_nonspacing_table.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2019-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $range_start = undef;
 my $codepoint;
diff --git a/src/common/unicode/generate-unicode_norm_table.pl b/src/common/unicode/generate-unicode_norm_table.pl
index d5914118ab..65b001d065 100644
--- a/src/common/unicode/generate-unicode_norm_table.pl
+++ b/src/common/unicode/generate-unicode_norm_table.pl
@@ -9,7 +9,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/common/unicode/generate-unicode_normprops_table.pl b/src/common/unicode/generate-unicode_normprops_table.pl
index 1b7473180b..f831c2d0d5 100644
--- a/src/common/unicode/generate-unicode_normprops_table.pl
+++ b/src/common/unicode/generate-unicode_normprops_table.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2020-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib "$FindBin::RealBin/../../tools/";
diff --git a/src/include/catalog/duplicate_oids b/src/include/catalog/duplicate_oids
index eb5c3fb084..1830b95b0a 100755
--- a/src/include/catalog/duplicate_oids
+++ b/src/include/catalog/duplicate_oids
@@ -17,7 +17,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Must run in src/include/catalog
 use FindBin;
diff --git a/src/include/catalog/reformat_dat_file.pl b/src/include/catalog/reformat_dat_file.pl
index 725117d846..b5235c24d3 100755
--- a/src/include/catalog/reformat_dat_file.pl
+++ b/src/include/catalog/reformat_dat_file.pl
@@ -18,7 +18,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use Getopt::Long;
diff --git a/src/include/catalog/renumber_oids.pl b/src/include/catalog/renumber_oids.pl
index ec09584959..a418b33d58 100755
--- a/src/include/catalog/renumber_oids.pl
+++ b/src/include/catalog/renumber_oids.pl
@@ -16,7 +16,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use Getopt::Long;
diff --git a/src/include/catalog/unused_oids b/src/include/catalog/unused_oids
index ccf3c3f781..f5f0c57b74 100755
--- a/src/include/catalog/unused_oids
+++ b/src/include/catalog/unused_oids
@@ -19,7 +19,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Must run in src/include/catalog
 use FindBin;
diff --git a/src/interfaces/ecpg/preproc/check_rules.pl b/src/interfaces/ecpg/preproc/check_rules.pl
index 5e823fa30e..6417ee7315 100644
--- a/src/interfaces/ecpg/preproc/check_rules.pl
+++ b/src/interfaces/ecpg/preproc/check_rules.pl
@@ -17,7 +17,7 @@
 # Then it checks to make sure each rule in ecpg.addons was found in gram.y
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $srcdir = '.';
diff --git a/src/interfaces/ecpg/preproc/parse.pl b/src/interfaces/ecpg/preproc/parse.pl
index 7574fc3110..b0caeb356f 100644
--- a/src/interfaces/ecpg/preproc/parse.pl
+++ b/src/interfaces/ecpg/preproc/parse.pl
@@ -13,7 +13,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $srcdir = '.';
diff --git a/src/interfaces/libpq/t/001_uri.pl b/src/interfaces/libpq/t/001_uri.pl
index fd062a95c5..cd876e758f 100644
--- a/src/interfaces/libpq/t/001_uri.pl
+++ b/src/interfaces/libpq/t/001_uri.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/interfaces/libpq/t/002_api.pl b/src/interfaces/libpq/t/002_api.pl
index 8b43a984fb..9d376bcaa2 100644
--- a/src/interfaces/libpq/t/002_api.pl
+++ b/src/interfaces/libpq/t/002_api.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/interfaces/libpq/t/003_load_balance_host_list.pl b/src/interfaces/libpq/t/003_load_balance_host_list.pl
index 21c3b8dd33..c6fe049fe5 100644
--- a/src/interfaces/libpq/t/003_load_balance_host_list.pl
+++ b/src/interfaces/libpq/t/003_load_balance_host_list.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config;
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
diff --git a/src/interfaces/libpq/t/004_load_balance_dns.pl b/src/interfaces/libpq/t/004_load_balance_dns.pl
index 875070e212..81cf628ac7 100644
--- a/src/interfaces/libpq/t/004_load_balance_dns.pl
+++ b/src/interfaces/libpq/t/004_load_balance_dns.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config;
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
diff --git a/src/pl/plperl/plc_perlboot.pl b/src/pl/plperl/plc_perlboot.pl
index 13298013d3..90c1b7e667 100644
--- a/src/pl/plperl/plc_perlboot.pl
+++ b/src/pl/plperl/plc_perlboot.pl
@@ -4,7 +4,7 @@
 #  src/pl/plperl/plc_perlboot.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use vars qw(%_SHARED $_TD);
 
@@ -58,7 +58,7 @@ sub ::encode_array_constructor
 	package PostgreSQL::InServer;  ## no critic (RequireFilenameMatchesPackage)
 #>>>
 	use strict;
-	use warnings;
+	use warnings FATAL => 'all';
 
 	sub plperl_warn
 	{
@@ -107,7 +107,7 @@ sub ::encode_array_constructor
 
 	package PostgreSQL::InServer::ARRAY;
 	use strict;
-	use warnings;
+	use warnings FATAL => 'all';
 
 	use overload
 	  '""' => \&to_str,
diff --git a/src/pl/plperl/plperl_opmask.pl b/src/pl/plperl/plperl_opmask.pl
index 26ac717770..09dc72d273 100644
--- a/src/pl/plperl/plperl_opmask.pl
+++ b/src/pl/plperl/plperl_opmask.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Opcode qw(opset opset_to_ops opdesc);
 
diff --git a/src/pl/plperl/text2macro.pl b/src/pl/plperl/text2macro.pl
index 933632c0df..7a41da84c6 100644
--- a/src/pl/plperl/text2macro.pl
+++ b/src/pl/plperl/text2macro.pl
@@ -27,7 +27,7 @@ =head1 DESCRIPTION
 =cut
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Getopt::Long;
 
diff --git a/src/pl/plpgsql/src/generate-plerrcodes.pl b/src/pl/plpgsql/src/generate-plerrcodes.pl
index f4fd376ef9..03ce58b94e 100644
--- a/src/pl/plpgsql/src/generate-plerrcodes.pl
+++ b/src/pl/plpgsql/src/generate-plerrcodes.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
diff --git a/src/pl/plpython/generate-spiexceptions.pl b/src/pl/plpython/generate-spiexceptions.pl
index 61b37c3541..090e20472c 100644
--- a/src/pl/plpython/generate-spiexceptions.pl
+++ b/src/pl/plpython/generate-spiexceptions.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
diff --git a/src/pl/tcl/generate-pltclerrcodes.pl b/src/pl/tcl/generate-pltclerrcodes.pl
index 9c2309108c..df1ba7d4d4 100644
--- a/src/pl/tcl/generate-pltclerrcodes.pl
+++ b/src/pl/tcl/generate-pltclerrcodes.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
diff --git a/src/test/authentication/t/001_password.pl b/src/test/authentication/t/001_password.pl
index 12552837a8..56b3cd0ab7 100644
--- a/src/test/authentication/t/001_password.pl
+++ b/src/test/authentication/t/001_password.pl
@@ -9,7 +9,7 @@
 # This test can only run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/002_saslprep.pl b/src/test/authentication/t/002_saslprep.pl
index ef15831166..c3a73dfda1 100644
--- a/src/test/authentication/t/002_saslprep.pl
+++ b/src/test/authentication/t/002_saslprep.pl
@@ -6,7 +6,7 @@
 # This test can only run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/003_peer.pl b/src/test/authentication/t/003_peer.pl
index eacff2b52a..96217b6661 100644
--- a/src/test/authentication/t/003_peer.pl
+++ b/src/test/authentication/t/003_peer.pl
@@ -6,7 +6,7 @@
 # and is only able to run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/004_file_inclusion.pl b/src/test/authentication/t/004_file_inclusion.pl
index 55d28ad586..364bba81ca 100644
--- a/src/test/authentication/t/004_file_inclusion.pl
+++ b/src/test/authentication/t/004_file_inclusion.pl
@@ -5,7 +5,7 @@
 # only run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use File::Basename qw(basename);
diff --git a/src/test/authentication/t/005_sspi.pl b/src/test/authentication/t/005_sspi.pl
index 37fd5bc243..bdc829dcf8 100644
--- a/src/test/authentication/t/005_sspi.pl
+++ b/src/test/authentication/t/005_sspi.pl
@@ -4,7 +4,7 @@
 # Tests targeting SSPI on Windows.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/icu/t/010_database.pl b/src/test/icu/t/010_database.pl
index 0e9446cebe..083c6f26e2 100644
--- a/src/test/icu/t/010_database.pl
+++ b/src/test/icu/t/010_database.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index 0deb9bffc8..e9ceb712f5 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -18,7 +18,7 @@
 # See the README for additional information.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/test/ldap/LdapServer.pm b/src/test/ldap/LdapServer.pm
index a4c1a1843c..f63844d60a 100644
--- a/src/test/ldap/LdapServer.pm
+++ b/src/test/ldap/LdapServer.pm
@@ -46,7 +46,7 @@ LdapServer - class for an LDAP server for testing pg_hba.conf authentication
 package LdapServer;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 3e113fd6eb..5e569c4db9 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib "$FindBin::RealBin/..";
diff --git a/src/test/ldap/t/002_bindpasswd.pl b/src/test/ldap/t/002_bindpasswd.pl
index bcd4aa2b74..204ed39059 100644
--- a/src/test/ldap/t/002_bindpasswd.pl
+++ b/src/test/ldap/t/002_bindpasswd.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib "$FindBin::RealBin/..";
diff --git a/src/test/locale/sort-test.pl b/src/test/locale/sort-test.pl
index 8bed29b3ad..47efa8f8bb 100755
--- a/src/test/locale/sort-test.pl
+++ b/src/test/locale/sort-test.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use locale;
 
 open(my $in_fh, '<', $ARGV[0]) || die;
diff --git a/src/test/modules/brin/t/01_workitems.pl b/src/test/modules/brin/t/01_workitems.pl
index 5f71074231..376c3a43f1 100644
--- a/src/test/modules/brin/t/01_workitems.pl
+++ b/src/test/modules/brin/t/01_workitems.pl
@@ -4,7 +4,7 @@
 # Verify that work items work correctly
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/brin/t/02_wal_consistency.pl b/src/test/modules/brin/t/02_wal_consistency.pl
index 8b2b244feb..a588a28669 100644
--- a/src/test/modules/brin/t/02_wal_consistency.pl
+++ b/src/test/modules/brin/t/02_wal_consistency.pl
@@ -3,7 +3,7 @@
 # Verify WAL consistency
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/001_base.pl b/src/test/modules/commit_ts/t/001_base.pl
index ae3fc5f52d..d6ea0c4c69 100644
--- a/src/test/modules/commit_ts/t/001_base.pl
+++ b/src/test/modules/commit_ts/t/001_base.pl
@@ -4,7 +4,7 @@
 # Single-node test: value can be set, and is still present after recovery
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/002_standby.pl b/src/test/modules/commit_ts/t/002_standby.pl
index 59cc2b1244..e843578ddb 100644
--- a/src/test/modules/commit_ts/t/002_standby.pl
+++ b/src/test/modules/commit_ts/t/002_standby.pl
@@ -4,7 +4,7 @@
 # Test simple scenario involving a standby
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl
index 5af511e369..b38c3c0f26 100644
--- a/src/test/modules/commit_ts/t/003_standby_2.pl
+++ b/src/test/modules/commit_ts/t/003_standby_2.pl
@@ -4,7 +4,7 @@
 # Test primary/standby scenario where the track_commit_timestamp GUC is
 # repeatedly toggled on and off.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/004_restart.pl b/src/test/modules/commit_ts/t/004_restart.pl
index 8fe4bedb14..399268ebee 100644
--- a/src/test/modules/commit_ts/t/004_restart.pl
+++ b/src/test/modules/commit_ts/t/004_restart.pl
@@ -3,7 +3,7 @@
 
 # Testing of commit timestamps preservation across restarts
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl b/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
index c96c8d7a4d..b7ac65091a 100644
--- a/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
+++ b/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2022, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Copy;
 use FindBin;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
index 056fa5c6d2..71a11ddf25 100644
--- a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
+++ b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
index 2b2c144ee2..c63e7bd394 100644
--- a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
+++ b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Copy;
 
diff --git a/src/test/modules/test_custom_rmgrs/t/001_basic.pl b/src/test/modules/test_custom_rmgrs/t/001_basic.pl
index 50655d3788..dc3d830299 100644
--- a/src/test/modules/test_custom_rmgrs/t/001_basic.pl
+++ b/src/test/modules/test_custom_rmgrs/t/001_basic.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/test_misc/t/001_constraint_validation.pl b/src/test/modules/test_misc/t/001_constraint_validation.pl
index 5a07a5d36d..4d0ea0c59d 100644
--- a/src/test/modules/test_misc/t/001_constraint_validation.pl
+++ b/src/test/modules/test_misc/t/001_constraint_validation.pl
@@ -4,7 +4,7 @@
 # Verify that ALTER TABLE optimizes certain operations as expected
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/test_misc/t/002_tablespace.pl b/src/test/modules/test_misc/t/002_tablespace.pl
index f774a021a8..220e2b073d 100644
--- a/src/test/modules/test_misc/t/002_tablespace.pl
+++ b/src/test/modules/test_misc/t/002_tablespace.pl
@@ -3,7 +3,7 @@
 # regression tests.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/test_misc/t/003_check_guc.pl b/src/test/modules/test_misc/t/003_check_guc.pl
index 4fd6d03b9e..5dab498c22 100644
--- a/src/test/modules/test_misc/t/003_check_guc.pl
+++ b/src/test/modules/test_misc/t/003_check_guc.pl
@@ -2,7 +2,7 @@
 # postgresql.conf.sample.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/test_misc/t/004_io_direct.pl b/src/test/modules/test_misc/t/004_io_direct.pl
index dddcfb1aa9..e3f0966b8d 100644
--- a/src/test/modules/test_misc/t/004_io_direct.pl
+++ b/src/test/modules/test_misc/t/004_io_direct.pl
@@ -1,7 +1,7 @@
 # Very simple exercise of direct I/O GUC.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Fcntl;
 use IO::File;
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl
index d00c3544e9..bf7f92d13f 100644
--- a/src/test/modules/test_pg_dump/t/001_base.pl
+++ b/src/test/modules/test_pg_dump/t/001_base.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/worker_spi/t/001_worker_spi.pl b/src/test/modules/worker_spi/t/001_worker_spi.pl
index 2965acd789..312359dd4b 100644
--- a/src/test/modules/worker_spi/t/001_worker_spi.pl
+++ b/src/test/modules/worker_spi/t/001_worker_spi.pl
@@ -3,7 +3,7 @@
 # Test worker_spi module.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
index e34dfb9243..1b1078f8c6 100644
--- a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
+++ b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
@@ -30,7 +30,7 @@ compare the results of cross-version upgrade tests.
 package PostgreSQL::Test::AdjustUpgrade;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Exporter 'import';
 use PostgreSQL::Version;
diff --git a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
index 924b57ab21..bd41c8bd10 100644
--- a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
+++ b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
@@ -54,7 +54,7 @@ initiated by PostgreSQL::Test::Cluster.
 package PostgreSQL::Test::BackgroundPsql;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Config;
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 5e161dbee6..3fa679ff97 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -97,7 +97,7 @@ The IPC::Run module is required.
 package PostgreSQL::Test::Cluster;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Config;
diff --git a/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm b/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
index 15964e6217..1c79bfabd1 100644
--- a/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
+++ b/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
@@ -19,7 +19,7 @@ PostgreSQL::Test::RecursiveCopy::copypath($from, $to);
 package PostgreSQL::Test::RecursiveCopy;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use File::Basename;
diff --git a/src/test/perl/PostgreSQL/Test/SimpleTee.pm b/src/test/perl/PostgreSQL/Test/SimpleTee.pm
index 82099bf503..9258b7c4cd 100644
--- a/src/test/perl/PostgreSQL/Test/SimpleTee.pm
+++ b/src/test/perl/PostgreSQL/Test/SimpleTee.pm
@@ -17,7 +17,7 @@
 
 package PostgreSQL::Test::SimpleTee;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Time::HiRes qw(time);
 
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index 617caa022f..ca13574966 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -42,7 +42,7 @@ aimed at controlling command execution, logging and test functions.
 package PostgreSQL::Test::Utils;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Config;
diff --git a/src/test/perl/PostgreSQL/Version.pm b/src/test/perl/PostgreSQL/Version.pm
index 3705c1bdaf..dadc90fecc 100644
--- a/src/test/perl/PostgreSQL/Version.pm
+++ b/src/test/perl/PostgreSQL/Version.pm
@@ -45,7 +45,7 @@ of common version formats and comparison operations.
 package PostgreSQL::Version;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Scalar::Util qw(blessed);
 
diff --git a/src/test/perl/README b/src/test/perl/README
index 8fb44184b9..af037a8091 100644
--- a/src/test/perl/README
+++ b/src/test/perl/README
@@ -58,7 +58,7 @@ order.
 Each test script should begin with:
 
     use strict;
-    use warnings;
+    use warnings FATAL => 'all';
     use PostgreSQL::Test::Cluster;
     use PostgreSQL::Test::Utils;
     use Test::More;
diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl
index 0c72ba0944..3526f2d554 100644
--- a/src/test/recovery/t/001_stream_rep.pl
+++ b/src/test/recovery/t/001_stream_rep.pl
@@ -3,7 +3,7 @@
 
 # Minimal test testing streaming replication
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/002_archiving.pl b/src/test/recovery/t/002_archiving.pl
index 48e00f9e29..c4d0a2a81f 100644
--- a/src/test/recovery/t/002_archiving.pl
+++ b/src/test/recovery/t/002_archiving.pl
@@ -3,7 +3,7 @@
 
 # test for archiving with hot standby
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.pl
index e882ce2077..1b63116ceb 100644
--- a/src/test/recovery/t/003_recovery_targets.pl
+++ b/src/test/recovery/t/003_recovery_targets.pl
@@ -3,7 +3,7 @@
 
 # Test for recovery targets: name, timestamp, XID
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/004_timeline_switch.pl b/src/test/recovery/t/004_timeline_switch.pl
index edaef91845..2500201b99 100644
--- a/src/test/recovery/t/004_timeline_switch.pl
+++ b/src/test/recovery/t/004_timeline_switch.pl
@@ -3,7 +3,7 @@
 
 # Test for timeline switch
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/005_replay_delay.pl b/src/test/recovery/t/005_replay_delay.pl
index 8fadca4204..2f7a99e687 100644
--- a/src/test/recovery/t/005_replay_delay.pl
+++ b/src/test/recovery/t/005_replay_delay.pl
@@ -3,7 +3,7 @@
 
 # Checks for recovery_min_apply_delay and recovery pause
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl
index 5025d65b1b..928093627e 100644
--- a/src/test/recovery/t/006_logical_decoding.pl
+++ b/src/test/recovery/t/006_logical_decoding.pl
@@ -7,7 +7,7 @@
 # is for work that doesn't fit well there, like where server restarts
 # are required.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/007_sync_rep.pl b/src/test/recovery/t/007_sync_rep.pl
index 2026af0702..b25ae1e8ec 100644
--- a/src/test/recovery/t/007_sync_rep.pl
+++ b/src/test/recovery/t/007_sync_rep.pl
@@ -3,7 +3,7 @@
 
 # Minimal test testing synchronous replication sync_state transition
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/008_fsm_truncation.pl b/src/test/recovery/t/008_fsm_truncation.pl
index acac0a0a55..10d1535a93 100644
--- a/src/test/recovery/t/008_fsm_truncation.pl
+++ b/src/test/recovery/t/008_fsm_truncation.pl
@@ -6,7 +6,7 @@
 # FSM changes don't normally need to be WAL-logged, except for truncation.
 # The FSM mustn't return a page that doesn't exist (anymore).
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl
index e1273fd0f1..cde6e2a944 100644
--- a/src/test/recovery/t/009_twophase.pl
+++ b/src/test/recovery/t/009_twophase.pl
@@ -3,7 +3,7 @@
 
 # Tests dedicated to two-phase commit in recovery
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl
index 6fbbeedde3..2359821b28 100644
--- a/src/test/recovery/t/010_logical_decoding_timelines.pl
+++ b/src/test/recovery/t/010_logical_decoding_timelines.pl
@@ -22,7 +22,7 @@
 # on logical slots).
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/012_subtransactions.pl b/src/test/recovery/t/012_subtransactions.pl
index 91ae79dd51..32434d4340 100644
--- a/src/test/recovery/t/012_subtransactions.pl
+++ b/src/test/recovery/t/012_subtransactions.pl
@@ -3,7 +3,7 @@
 
 # Tests dedicated to subtransactions in recovery
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/013_crash_restart.pl b/src/test/recovery/t/013_crash_restart.pl
index ce57792f31..0dfd197df4 100644
--- a/src/test/recovery/t/013_crash_restart.pl
+++ b/src/test/recovery/t/013_crash_restart.pl
@@ -12,7 +12,7 @@
 # backend died), or because it's already restarted.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/014_unlogged_reinit.pl b/src/test/recovery/t/014_unlogged_reinit.pl
index 3591b3309e..bee8b8804f 100644
--- a/src/test/recovery/t/014_unlogged_reinit.pl
+++ b/src/test/recovery/t/014_unlogged_reinit.pl
@@ -7,7 +7,7 @@
 # that is not tested here.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/015_promotion_pages.pl b/src/test/recovery/t/015_promotion_pages.pl
index beeb9dfddf..b49dd4c835 100644
--- a/src/test/recovery/t/015_promotion_pages.pl
+++ b/src/test/recovery/t/015_promotion_pages.pl
@@ -6,7 +6,7 @@
 # invalid page references at replay based on the minimum consistent
 # recovery point defined.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/016_min_consistency.pl b/src/test/recovery/t/016_min_consistency.pl
index 81f7a43c07..cabdd3156e 100644
--- a/src/test/recovery/t/016_min_consistency.pl
+++ b/src/test/recovery/t/016_min_consistency.pl
@@ -8,7 +8,7 @@
 # both checked.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/017_shm.pl b/src/test/recovery/t/017_shm.pl
index 74359e0e38..7935ce63d3 100644
--- a/src/test/recovery/t/017_shm.pl
+++ b/src/test/recovery/t/017_shm.pl
@@ -5,7 +5,7 @@
 # Tests of pg_shmem.h functions
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::stat qw(stat);
 use IPC::Run 'run';
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/recovery/t/018_wal_optimize.pl b/src/test/recovery/t/018_wal_optimize.pl
index 1d613eaede..0752bff174 100644
--- a/src/test/recovery/t/018_wal_optimize.pl
+++ b/src/test/recovery/t/018_wal_optimize.pl
@@ -10,7 +10,7 @@
 # For many years, individual commands made the decision to skip WAL, hence the
 # frequent appearance of COPY in these tests.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/019_replslot_limit.pl b/src/test/recovery/t/019_replslot_limit.pl
index 33e50ad933..c0b71934cf 100644
--- a/src/test/recovery/t/019_replslot_limit.pl
+++ b/src/test/recovery/t/019_replslot_limit.pl
@@ -5,7 +5,7 @@
 # Ensure that max_slot_wal_keep_size limits the number of WAL files to
 # be kept by replication slots.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/recovery/t/020_archive_status.pl b/src/test/recovery/t/020_archive_status.pl
index fa24153d4b..ce51bfb58e 100644
--- a/src/test/recovery/t/020_archive_status.pl
+++ b/src/test/recovery/t/020_archive_status.pl
@@ -5,7 +5,7 @@
 # Tests related to WAL archiving and recovery.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/021_row_visibility.pl b/src/test/recovery/t/021_row_visibility.pl
index 52a6a3509c..3bdd42c25d 100644
--- a/src/test/recovery/t/021_row_visibility.pl
+++ b/src/test/recovery/t/021_row_visibility.pl
@@ -4,7 +4,7 @@
 # Checks that snapshots on standbys behave in a minimally reasonable
 # way.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/022_crash_temp_files.pl b/src/test/recovery/t/022_crash_temp_files.pl
index 14fd8bfc7f..e702323a8f 100644
--- a/src/test/recovery/t/022_crash_temp_files.pl
+++ b/src/test/recovery/t/022_crash_temp_files.pl
@@ -3,7 +3,7 @@
 
 # Test remove of temporary files after a crash.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/023_pitr_prepared_xact.pl b/src/test/recovery/t/023_pitr_prepared_xact.pl
index a8cdf4efdd..090711ca4b 100644
--- a/src/test/recovery/t/023_pitr_prepared_xact.pl
+++ b/src/test/recovery/t/023_pitr_prepared_xact.pl
@@ -3,7 +3,7 @@
 
 # Test for point-in-time recovery (PITR) with prepared transactions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/024_archive_recovery.pl b/src/test/recovery/t/024_archive_recovery.pl
index d594332b18..e9ab11895f 100644
--- a/src/test/recovery/t/024_archive_recovery.pl
+++ b/src/test/recovery/t/024_archive_recovery.pl
@@ -3,7 +3,7 @@
 
 # Test for archive recovery of WAL generated with wal_level=minimal
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/025_stuck_on_old_timeline.pl b/src/test/recovery/t/025_stuck_on_old_timeline.pl
index 91309030df..65d8864327 100644
--- a/src/test/recovery/t/025_stuck_on_old_timeline.pl
+++ b/src/test/recovery/t/025_stuck_on_old_timeline.pl
@@ -7,7 +7,7 @@
 # archive, so the WAL files all have to be streamed.  Test that the cascading
 # standby can follow the new primary (promoted standby).
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 
diff --git a/src/test/recovery/t/026_overwrite_contrecord.pl b/src/test/recovery/t/026_overwrite_contrecord.pl
index 6807a97f26..09c7e13da9 100644
--- a/src/test/recovery/t/026_overwrite_contrecord.pl
+++ b/src/test/recovery/t/026_overwrite_contrecord.pl
@@ -3,7 +3,7 @@
 # Tests for already-propagated WAL segments ending in incomplete WAL records.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/recovery/t/027_stream_regress.pl b/src/test/recovery/t/027_stream_regress.pl
index f2f4e77626..20508307b5 100644
--- a/src/test/recovery/t/027_stream_regress.pl
+++ b/src/test/recovery/t/027_stream_regress.pl
@@ -1,6 +1,6 @@
 # Run the standard regression tests with streaming replication
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/028_pitr_timelines.pl b/src/test/recovery/t/028_pitr_timelines.pl
index bb29a2d378..58390b6d79 100644
--- a/src/test/recovery/t/028_pitr_timelines.pl
+++ b/src/test/recovery/t/028_pitr_timelines.pl
@@ -27,7 +27,7 @@
 # The actual checks are not sensitive to that.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/029_stats_restart.pl b/src/test/recovery/t/029_stats_restart.pl
index 742bd57e28..b8c7e9cd5c 100644
--- a/src/test/recovery/t/029_stats_restart.pl
+++ b/src/test/recovery/t/029_stats_restart.pl
@@ -4,7 +4,7 @@
 # invalid stats files, as well as restorting stats after "normal" restarts.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/030_stats_cleanup_replica.pl b/src/test/recovery/t/030_stats_cleanup_replica.pl
index 51495aebcd..db451d9d1b 100644
--- a/src/test/recovery/t/030_stats_cleanup_replica.pl
+++ b/src/test/recovery/t/030_stats_cleanup_replica.pl
@@ -6,7 +6,7 @@
 # - discard stats after immediate / crash restarts
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/031_recovery_conflict.pl b/src/test/recovery/t/031_recovery_conflict.pl
index 05e83fa854..c773344f50 100644
--- a/src/test/recovery/t/031_recovery_conflict.pl
+++ b/src/test/recovery/t/031_recovery_conflict.pl
@@ -5,7 +5,7 @@
 # pg_stat_database_conflicts are populated correctly
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/032_relfilenode_reuse.pl b/src/test/recovery/t/032_relfilenode_reuse.pl
index 3bc2db1a4f..8a4cceacc2 100644
--- a/src/test/recovery/t/032_relfilenode_reuse.pl
+++ b/src/test/recovery/t/032_relfilenode_reuse.pl
@@ -1,5 +1,5 @@
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/033_replay_tsp_drops.pl b/src/test/recovery/t/033_replay_tsp_drops.pl
index af97ed9f70..64c370224c 100644
--- a/src/test/recovery/t/033_replay_tsp_drops.pl
+++ b/src/test/recovery/t/033_replay_tsp_drops.pl
@@ -4,7 +4,7 @@
 # Test replay of tablespace/database creation/drop
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/034_create_database.pl b/src/test/recovery/t/034_create_database.pl
index ed562bba25..d4d7500dd5 100644
--- a/src/test/recovery/t/034_create_database.pl
+++ b/src/test/recovery/t/034_create_database.pl
@@ -4,7 +4,7 @@
 # Test WAL replay for CREATE DATABASE .. STRATEGY WAL_LOG.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/035_standby_logical_decoding.pl b/src/test/recovery/t/035_standby_logical_decoding.pl
index 480e6d6caa..1ebf50fe3e 100644
--- a/src/test/recovery/t/035_standby_logical_decoding.pl
+++ b/src/test/recovery/t/035_standby_logical_decoding.pl
@@ -4,7 +4,7 @@
 # recovery conflict and standby promotion.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/036_truncated_dropped.pl b/src/test/recovery/t/036_truncated_dropped.pl
index 2d5339d9d8..53194978fc 100644
--- a/src/test/recovery/t/036_truncated_dropped.pl
+++ b/src/test/recovery/t/036_truncated_dropped.pl
@@ -5,7 +5,7 @@
 # truncated or dropped.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/recovery/t/037_invalid_database.pl b/src/test/recovery/t/037_invalid_database.pl
index 29b9bb6977..a6b23c3ba7 100644
--- a/src/test/recovery/t/037_invalid_database.pl
+++ b/src/test/recovery/t/037_invalid_database.pl
@@ -3,7 +3,7 @@
 # Test we handle interrupted DROP DATABASE correctly.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/cp_history_files b/src/test/recovery/t/cp_history_files
index cfeea41e5b..5832b98ef4 100644
--- a/src/test/recovery/t/cp_history_files
+++ b/src/test/recovery/t/cp_history_files
@@ -2,7 +2,7 @@
 
 use File::Copy;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 die "wrong number of arguments" if @ARGV != 2;
 my ($source, $target) = @ARGV;
diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index 76442de063..860edb9ff7 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config qw ( %Config );
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
@@ -713,6 +713,8 @@ sub switch_server_cert
 	# integer like how we do when grabbing the serial fails.
 	if ($Config{ivsize} == 8)
 	{
+		no warnings qw(portable);
+
 		$serialno =~ s/^serial=//;
 		$serialno =~ s/\s+//g;
 		$serialno = hex($serialno);
diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl
index 27abd02abf..a556c66bff 100644
--- a/src/test/ssl/t/002_scram.pl
+++ b/src/test/ssl/t/002_scram.pl
@@ -4,7 +4,7 @@
 # Test SCRAM authentication and TLS channel binding types
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/ssl/t/003_sslinfo.pl b/src/test/ssl/t/003_sslinfo.pl
index 5306aad802..866fe5ad2c 100644
--- a/src/test/ssl/t/003_sslinfo.pl
+++ b/src/test/ssl/t/003_sslinfo.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/ssl/t/SSL/Backend/OpenSSL.pm b/src/test/ssl/t/SSL/Backend/OpenSSL.pm
index a762f43634..a2b44f8516 100644
--- a/src/test/ssl/t/SSL/Backend/OpenSSL.pm
+++ b/src/test/ssl/t/SSL/Backend/OpenSSL.pm
@@ -25,7 +25,7 @@ for a PostgreSQL cluster compiled against OpenSSL.
 package SSL::Backend::OpenSSL;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename;
 use File::Copy;
 
diff --git a/src/test/ssl/t/SSL/Server.pm b/src/test/ssl/t/SSL/Server.pm
index 2c5c055222..836e098902 100644
--- a/src/test/ssl/t/SSL/Server.pm
+++ b/src/test/ssl/t/SSL/Server.pm
@@ -64,7 +64,7 @@ specific infrastructure. Currently only OpenSSL is supported.
 package SSL::Server;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl
index 0a399cdb82..a69a53e19c 100644
--- a/src/test/subscription/t/001_rep_changes.pl
+++ b/src/test/subscription/t/001_rep_changes.pl
@@ -3,7 +3,7 @@
 
 # Basic logical replication test
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/002_types.pl b/src/test/subscription/t/002_types.pl
index 6b5853b80b..73f6c52977 100644
--- a/src/test/subscription/t/002_types.pl
+++ b/src/test/subscription/t/002_types.pl
@@ -4,7 +4,7 @@
 # This tests that more complex datatypes are replicated correctly
 # by logical replication
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/003_constraints.pl b/src/test/subscription/t/003_constraints.pl
index 6e902360cc..a78061b22f 100644
--- a/src/test/subscription/t/003_constraints.pl
+++ b/src/test/subscription/t/003_constraints.pl
@@ -3,7 +3,7 @@
 
 # This test checks that constraints work on subscriber
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/004_sync.pl b/src/test/subscription/t/004_sync.pl
index aa7714c533..000154b75e 100644
--- a/src/test/subscription/t/004_sync.pl
+++ b/src/test/subscription/t/004_sync.pl
@@ -3,7 +3,7 @@
 
 # Tests for logical replication table syncing
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/005_encoding.pl b/src/test/subscription/t/005_encoding.pl
index 2f0bf7730b..a7e88e42f7 100644
--- a/src/test/subscription/t/005_encoding.pl
+++ b/src/test/subscription/t/005_encoding.pl
@@ -3,7 +3,7 @@
 
 # Test replication between databases with different encodings
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/006_rewrite.pl b/src/test/subscription/t/006_rewrite.pl
index 8bc7e872d9..2a2d27f89f 100644
--- a/src/test/subscription/t/006_rewrite.pl
+++ b/src/test/subscription/t/006_rewrite.pl
@@ -3,7 +3,7 @@
 
 # Test logical replication behavior with heap rewrites
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/007_ddl.pl b/src/test/subscription/t/007_ddl.pl
index cbdb5b66e4..9bf69b35f7 100644
--- a/src/test/subscription/t/007_ddl.pl
+++ b/src/test/subscription/t/007_ddl.pl
@@ -3,7 +3,7 @@
 
 # Test some logical replication DDL behavior
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/008_diff_schema.pl b/src/test/subscription/t/008_diff_schema.pl
index c6e41b65b9..0b24cc45c2 100644
--- a/src/test/subscription/t/008_diff_schema.pl
+++ b/src/test/subscription/t/008_diff_schema.pl
@@ -3,7 +3,7 @@
 
 # Test behavior with different schema on subscriber
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/009_matviews.pl b/src/test/subscription/t/009_matviews.pl
index 38080b4313..36baf8bf3c 100644
--- a/src/test/subscription/t/009_matviews.pl
+++ b/src/test/subscription/t/009_matviews.pl
@@ -3,7 +3,7 @@
 
 # Test materialized views behavior
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/010_truncate.pl b/src/test/subscription/t/010_truncate.pl
index a5b6445392..9dc8c4d58f 100644
--- a/src/test/subscription/t/010_truncate.pl
+++ b/src/test/subscription/t/010_truncate.pl
@@ -3,7 +3,7 @@
 
 # Test TRUNCATE
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/011_generated.pl b/src/test/subscription/t/011_generated.pl
index 7711be295a..60b613a2ad 100644
--- a/src/test/subscription/t/011_generated.pl
+++ b/src/test/subscription/t/011_generated.pl
@@ -3,7 +3,7 @@
 
 # Test generated columns
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/012_collation.pl b/src/test/subscription/t/012_collation.pl
index 823550a31b..2efe201a6c 100644
--- a/src/test/subscription/t/012_collation.pl
+++ b/src/test/subscription/t/012_collation.pl
@@ -4,7 +4,7 @@
 # Test collations, in particular nondeterministic ones
 # (only works with ICU)
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/013_partition.pl b/src/test/subscription/t/013_partition.pl
index 275fb3b525..c79b89ef42 100644
--- a/src/test/subscription/t/013_partition.pl
+++ b/src/test/subscription/t/013_partition.pl
@@ -3,7 +3,7 @@
 
 # Test logical replication with partitioned tables
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/014_binary.pl b/src/test/subscription/t/014_binary.pl
index e5ce849c19..990dc4e9f1 100644
--- a/src/test/subscription/t/014_binary.pl
+++ b/src/test/subscription/t/014_binary.pl
@@ -4,7 +4,7 @@
 # Binary mode logical replication test
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/015_stream.pl b/src/test/subscription/t/015_stream.pl
index b450a78adf..79a6d094c0 100644
--- a/src/test/subscription/t/015_stream.pl
+++ b/src/test/subscription/t/015_stream.pl
@@ -3,7 +3,7 @@
 
 # Test streaming of simple large transaction
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/016_stream_subxact.pl b/src/test/subscription/t/016_stream_subxact.pl
index 838049af65..ffc02fa47c 100644
--- a/src/test/subscription/t/016_stream_subxact.pl
+++ b/src/test/subscription/t/016_stream_subxact.pl
@@ -3,7 +3,7 @@
 
 # Test streaming of transaction containing subtransactions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/017_stream_ddl.pl b/src/test/subscription/t/017_stream_ddl.pl
index d00ede44ed..9aa41ad7b4 100644
--- a/src/test/subscription/t/017_stream_ddl.pl
+++ b/src/test/subscription/t/017_stream_ddl.pl
@@ -6,7 +6,7 @@
 # This file is mainly to test the DDL/DML interaction of the publisher side,
 # so we didn't add a parallel apply version for the tests in this file.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/018_stream_subxact_abort.pl b/src/test/subscription/t/018_stream_subxact_abort.pl
index 77c96011a9..f6c759368e 100644
--- a/src/test/subscription/t/018_stream_subxact_abort.pl
+++ b/src/test/subscription/t/018_stream_subxact_abort.pl
@@ -3,7 +3,7 @@
 
 # Test streaming of transaction containing multiple subtransactions and rollbacks
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/019_stream_subxact_ddl_abort.pl b/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
index 6c2a9c5bf1..e9ab94ea97 100644
--- a/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
+++ b/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
@@ -7,7 +7,7 @@
 # This file is mainly to test the DDL/DML interaction of the publisher side,
 # so we didn't add a parallel apply version for the tests in this file.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/020_messages.pl b/src/test/subscription/t/020_messages.pl
index 826d39cd89..761e4399fd 100644
--- a/src/test/subscription/t/020_messages.pl
+++ b/src/test/subscription/t/020_messages.pl
@@ -3,7 +3,7 @@
 
 # Tests that logical decoding messages
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/021_twophase.pl b/src/test/subscription/t/021_twophase.pl
index 8ce4cfc983..d57219cb3b 100644
--- a/src/test/subscription/t/021_twophase.pl
+++ b/src/test/subscription/t/021_twophase.pl
@@ -3,7 +3,7 @@
 
 # logical replication of 2PC test
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/022_twophase_cascade.pl b/src/test/subscription/t/022_twophase_cascade.pl
index b37ed95c9e..9adbc4d1e8 100644
--- a/src/test/subscription/t/022_twophase_cascade.pl
+++ b/src/test/subscription/t/022_twophase_cascade.pl
@@ -8,7 +8,7 @@
 # Two-phase and parallel apply will be tested in 023_twophase_stream, so we
 # didn't add a parallel apply version for the tests in this file.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/023_twophase_stream.pl b/src/test/subscription/t/023_twophase_stream.pl
index fdc9e2a0f0..9f837a9811 100644
--- a/src/test/subscription/t/023_twophase_stream.pl
+++ b/src/test/subscription/t/023_twophase_stream.pl
@@ -3,7 +3,7 @@
 
 # Test logical replication of 2PC with streaming.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/024_add_drop_pub.pl b/src/test/subscription/t/024_add_drop_pub.pl
index 8614b1b5b3..0528ebf2fa 100644
--- a/src/test/subscription/t/024_add_drop_pub.pl
+++ b/src/test/subscription/t/024_add_drop_pub.pl
@@ -3,7 +3,7 @@
 
 # This test checks behaviour of ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/025_rep_changes_for_schema.pl b/src/test/subscription/t/025_rep_changes_for_schema.pl
index 8543f52710..64ec29a4b8 100644
--- a/src/test/subscription/t/025_rep_changes_for_schema.pl
+++ b/src/test/subscription/t/025_rep_changes_for_schema.pl
@@ -3,7 +3,7 @@
 
 # Logical replication tests for schema publications
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/026_stats.pl b/src/test/subscription/t/026_stats.pl
index 0bcda006cd..ad9cb8deff 100644
--- a/src/test/subscription/t/026_stats.pl
+++ b/src/test/subscription/t/026_stats.pl
@@ -3,7 +3,7 @@
 
 # Tests for subscription stats.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/027_nosuperuser.pl b/src/test/subscription/t/027_nosuperuser.pl
index d7a7e3ef5b..15b6a97721 100644
--- a/src/test/subscription/t/027_nosuperuser.pl
+++ b/src/test/subscription/t/027_nosuperuser.pl
@@ -3,7 +3,7 @@
 
 # Test that logical replication respects permissions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/subscription/t/028_row_filter.pl b/src/test/subscription/t/028_row_filter.pl
index aec483f785..9633e9e597 100644
--- a/src/test/subscription/t/028_row_filter.pl
+++ b/src/test/subscription/t/028_row_filter.pl
@@ -2,7 +2,7 @@
 
 # Test logical replication behavior with row filtering
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/029_on_error.pl b/src/test/subscription/t/029_on_error.pl
index fcab7386fe..d874e83896 100644
--- a/src/test/subscription/t/029_on_error.pl
+++ b/src/test/subscription/t/029_on_error.pl
@@ -3,7 +3,7 @@
 
 # Tests for disable_on_error and SKIP transaction features.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/030_origin.pl b/src/test/subscription/t/030_origin.pl
index 9ca1fa25d8..fa33f997e8 100644
--- a/src/test/subscription/t/030_origin.pl
+++ b/src/test/subscription/t/030_origin.pl
@@ -4,7 +4,7 @@
 # Test the CREATE SUBSCRIPTION 'origin' parameter and its interaction with
 # 'copy_data' parameter.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/031_column_list.pl b/src/test/subscription/t/031_column_list.pl
index dbff806040..35fa1e4d93 100644
--- a/src/test/subscription/t/031_column_list.pl
+++ b/src/test/subscription/t/031_column_list.pl
@@ -2,7 +2,7 @@
 
 # Test partial-column publication of tables
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/032_subscribe_use_index.pl b/src/test/subscription/t/032_subscribe_use_index.pl
index 880ef2d57a..f219140afa 100644
--- a/src/test/subscription/t/032_subscribe_use_index.pl
+++ b/src/test/subscription/t/032_subscribe_use_index.pl
@@ -2,7 +2,7 @@
 
 # Test logical replication behavior with subscriber using available index
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/033_run_as_table_owner.pl b/src/test/subscription/t/033_run_as_table_owner.pl
index 9de3c04a0c..348e183e60 100644
--- a/src/test/subscription/t/033_run_as_table_owner.pl
+++ b/src/test/subscription/t/033_run_as_table_owner.pl
@@ -3,7 +3,7 @@
 
 # Test that logical replication respects permissions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/subscription/t/100_bugs.pl b/src/test/subscription/t/100_bugs.pl
index 4fabc44168..63bd01d5a7 100644
--- a/src/test/subscription/t/100_bugs.pl
+++ b/src/test/subscription/t/100_bugs.pl
@@ -3,7 +3,7 @@
 
 # Tests for various bugs found over time
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/tools/PerfectHash.pm b/src/tools/PerfectHash.pm
index e54905a3ef..0587107962 100644
--- a/src/tools/PerfectHash.pm
+++ b/src/tools/PerfectHash.pm
@@ -30,7 +30,7 @@
 package PerfectHash;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 
 # At runtime, we'll compute two simple hash functions of the input key,
diff --git a/src/tools/check_bison_recursion.pl b/src/tools/check_bison_recursion.pl
index 18f14ad127..2f079a01a7 100755
--- a/src/tools/check_bison_recursion.pl
+++ b/src/tools/check_bison_recursion.pl
@@ -22,7 +22,7 @@
 #################################################################
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $debug = 0;
 
diff --git a/src/tools/ci/windows_build_config.pl b/src/tools/ci/windows_build_config.pl
index b0d4360c74..a3eb96b7fd 100644
--- a/src/tools/ci/windows_build_config.pl
+++ b/src/tools/ci/windows_build_config.pl
@@ -1,5 +1,5 @@
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 our $config;
 
diff --git a/src/tools/copyright.pl b/src/tools/copyright.pl
index 30c38c757b..4263b5a3eb 100755
--- a/src/tools/copyright.pl
+++ b/src/tools/copyright.pl
@@ -10,7 +10,7 @@
 #################################################################
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Find;
 use File::Basename;
diff --git a/src/tools/fix-old-flex-code.pl b/src/tools/fix-old-flex-code.pl
index d88e68b8b6..c9b0517ed4 100644
--- a/src/tools/fix-old-flex-code.pl
+++ b/src/tools/fix-old-flex-code.pl
@@ -16,7 +16,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Get command line argument.
 usage() if $#ARGV != 0;
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
index ed60abe956..08f839ed07 100644
--- a/src/tools/gen_export.pl
+++ b/src/tools/gen_export.pl
@@ -1,5 +1,5 @@
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $format;
diff --git a/src/tools/gen_keywordlist.pl b/src/tools/gen_keywordlist.pl
index 97a9ff1b30..2ad9c9a4a3 100644
--- a/src/tools/gen_keywordlist.pl
+++ b/src/tools/gen_keywordlist.pl
@@ -29,7 +29,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/tools/git_changelog b/src/tools/git_changelog
index 39e1b1fe15..f3c225d556 100755
--- a/src/tools/git_changelog
+++ b/src/tools/git_changelog
@@ -50,7 +50,7 @@
 
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 require Time::Local;
 require Getopt::Long;
 require IPC::Open2;
diff --git a/src/tools/mark_pgdllimport.pl b/src/tools/mark_pgdllimport.pl
index 45b4e73bff..a0ff7f0e2b 100755
--- a/src/tools/mark_pgdllimport.pl
+++ b/src/tools/mark_pgdllimport.pl
@@ -23,7 +23,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 for my $include_file (@ARGV)
 {
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index 05548d7c0a..39cf83ab5e 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -9,7 +9,7 @@ package Install;
 # src/tools/msvc/Install.pm
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Carp;
 use File::Basename;
 use File::Copy;
diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm
index 62fec1fee5..6a6fb0e230 100644
--- a/src/tools/msvc/MSBuildProject.pm
+++ b/src/tools/msvc/MSBuildProject.pm
@@ -11,7 +11,7 @@ package MSBuildProject;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Project);
 
 no warnings qw(redefine);    ## no critic
@@ -412,7 +412,7 @@ package VC2015Project;
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(MSBuildProject);
 
 no warnings qw(redefine);    ## no critic
@@ -437,7 +437,7 @@ package VC2017Project;
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(MSBuildProject);
 
 no warnings qw(redefine);    ## no critic
@@ -462,7 +462,7 @@ package VC2019Project;
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(MSBuildProject);
 
 no warnings qw(redefine);    ## no critic
@@ -487,7 +487,7 @@ package VC2022Project;
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(MSBuildProject);
 
 no warnings qw(redefine);    ## no critic
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 9e05eb91b1..91cdd56888 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -9,7 +9,7 @@ package Mkvcbuild;
 # src/tools/msvc/Mkvcbuild.pm
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use if ($^O eq "MSWin32"), 'Win32';
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
index 0507ad08c5..6e87c94b82 100644
--- a/src/tools/msvc/Project.pm
+++ b/src/tools/msvc/Project.pm
@@ -10,7 +10,7 @@ package Project;
 #
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename;
 
 sub _new
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index a50f730260..b0866cb94f 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -10,7 +10,7 @@ package Solution;
 #
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use VSObjectFactory;
 
 no warnings qw(redefine);    ## no critic
@@ -1242,7 +1242,7 @@ package VS2015Solution;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Solution);
 
 no warnings qw(redefine);    ## no critic
@@ -1270,7 +1270,7 @@ package VS2017Solution;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Solution);
 
 no warnings qw(redefine);    ## no critic
@@ -1298,7 +1298,7 @@ package VS2019Solution;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Solution);
 
 no warnings qw(redefine);    ## no critic
@@ -1326,7 +1326,7 @@ package VS2022Solution;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use base qw(Solution);
 
 no warnings qw(redefine);    ## no critic
diff --git a/src/tools/msvc/VSObjectFactory.pm b/src/tools/msvc/VSObjectFactory.pm
index 9df2ab4282..2850ad8b3d 100644
--- a/src/tools/msvc/VSObjectFactory.pm
+++ b/src/tools/msvc/VSObjectFactory.pm
@@ -11,7 +11,7 @@ package VSObjectFactory;
 
 use Carp;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Exporter;
 use Project;
diff --git a/src/tools/msvc/build.pl b/src/tools/msvc/build.pl
index 9853e5c3d8..a6934ed0ff 100644
--- a/src/tools/msvc/build.pl
+++ b/src/tools/msvc/build.pl
@@ -8,7 +8,7 @@
 # src/tools/msvc/build.pl
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib $FindBin::RealBin;
diff --git a/src/tools/msvc/config_default.pl b/src/tools/msvc/config_default.pl
index 8945e772c2..0b40f6e38f 100644
--- a/src/tools/msvc/config_default.pl
+++ b/src/tools/msvc/config_default.pl
@@ -3,7 +3,7 @@
 
 # Configuration arguments for vcbuild.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 our $config = {
 	asserts => 0,    # --enable-cassert
diff --git a/src/tools/msvc/dummylib/Win32.pm b/src/tools/msvc/dummylib/Win32.pm
index df2d7a2929..6c483d60a2 100644
--- a/src/tools/msvc/dummylib/Win32.pm
+++ b/src/tools/msvc/dummylib/Win32.pm
@@ -3,5 +3,5 @@
 
 package Win32;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 1;
diff --git a/src/tools/msvc/dummylib/Win32/Registry.pm b/src/tools/msvc/dummylib/Win32/Registry.pm
index e14636eb31..0abf53cb04 100644
--- a/src/tools/msvc/dummylib/Win32/Registry.pm
+++ b/src/tools/msvc/dummylib/Win32/Registry.pm
@@ -4,7 +4,7 @@
 package Win32::Registry;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use vars qw($HKEY_LOCAL_MACHINE);
 
diff --git a/src/tools/msvc/dummylib/Win32API/File.pm b/src/tools/msvc/dummylib/Win32API/File.pm
index 7baf34c4e5..42c066acbb 100644
--- a/src/tools/msvc/dummylib/Win32API/File.pm
+++ b/src/tools/msvc/dummylib/Win32API/File.pm
@@ -4,7 +4,7 @@
 package Win32API::File;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use constant { SEM_FAILCRITICALERRORS => 1, SEM_NOGPFAULTERRORBOX => 2 };
 sub SetErrormode { }
diff --git a/src/tools/msvc/gendef.pl b/src/tools/msvc/gendef.pl
index cf83d7d056..593a8e005c 100644
--- a/src/tools/msvc/gendef.pl
+++ b/src/tools/msvc/gendef.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use List::Util qw(min);
 use Getopt::Long;
 
diff --git a/src/tools/msvc/install.pl b/src/tools/msvc/install.pl
index 8de7cee90f..37cb8d6b43 100755
--- a/src/tools/msvc/install.pl
+++ b/src/tools/msvc/install.pl
@@ -7,7 +7,7 @@
 # src/tools/msvc/install.pl
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib $FindBin::RealBin;
diff --git a/src/tools/msvc/mkvcbuild.pl b/src/tools/msvc/mkvcbuild.pl
index 7f94b1a6c9..b2f43fafeb 100644
--- a/src/tools/msvc/mkvcbuild.pl
+++ b/src/tools/msvc/mkvcbuild.pl
@@ -8,7 +8,7 @@
 # src/tools/msvc/mkvcbuild.pl
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib $FindBin::RealBin;
diff --git a/src/tools/msvc/pgbison.pl b/src/tools/msvc/pgbison.pl
index 25df6699b5..0687a5b874 100644
--- a/src/tools/msvc/pgbison.pl
+++ b/src/tools/msvc/pgbison.pl
@@ -5,7 +5,7 @@
 # src/tools/msvc/pgbison.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 
diff --git a/src/tools/msvc/pgflex.pl b/src/tools/msvc/pgflex.pl
index c308a08b55..59361d59c9 100644
--- a/src/tools/msvc/pgflex.pl
+++ b/src/tools/msvc/pgflex.pl
@@ -5,7 +5,7 @@
 # src/tools/msvc/pgflex.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 78170d105d..e8ea1a68dc 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -5,7 +5,7 @@
 # src/tools/msvc/vcregress.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 our $config;
 
diff --git a/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl b/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
index fef5c86ca4..fb772cb89b 100644
--- a/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
+++ b/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2017-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd qw(getcwd);
 use File::Copy "cp";
diff --git a/src/tools/pginclude/pgcheckdefines b/src/tools/pginclude/pgcheckdefines
index a9fe79ebe5..68aa5d178e 100755
--- a/src/tools/pginclude/pgcheckdefines
+++ b/src/tools/pginclude/pgcheckdefines
@@ -23,7 +23,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd;
 use File::Basename;
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index bce63d95da..b81fbab2ab 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd qw(abs_path getcwd);
 use File::Find;
diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl
index 1f0074ded5..ad0f233758 100755
--- a/src/tools/version_stamp.pl
+++ b/src/tools/version_stamp.pl
@@ -21,7 +21,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Major version is hard-wired into the script.  We update it when we branch
 # a new development version.
diff --git a/src/tools/win32tzlist.pl b/src/tools/win32tzlist.pl
index 657f7d4879..3a1ca4cb15 100755
--- a/src/tools/win32tzlist.pl
+++ b/src/tools/win32tzlist.pl
@@ -16,7 +16,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Win32::Registry;
 
-- 
2.41.0

v2-0002-Avoid-use-of-Perl-getprotobyname.patchtext/plain; charset=UTF-8; name=v2-0002-Avoid-use-of-Perl-getprotobyname.patchDownload
From 54a5904e38d533d8dbf492d0f1f19674cbcf3d39 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 1 Aug 2023 13:43:34 +0200
Subject: [PATCH v2] Avoid use of Perl getprotobyname

getprotobyname returns undefined on some CI machines.  It's not clear
why.  The code overall still works, but it raises a warning.

In PostgreSQL C code, we always call socket() with 0 for the protocol
argument, so we should be able to do the same in Perl (since the Perl
documentation says that the arguments of the socket function are the
same as in C).  So do that, to avoid the issue.
---
 src/test/perl/PostgreSQL/Test/Cluster.pm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 3fa679ff97..ea6cbe5703 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -1570,9 +1570,8 @@ sub can_bind
 	my ($host, $port) = @_;
 	my $iaddr = inet_aton($host);
 	my $paddr = sockaddr_in($port, $iaddr);
-	my $proto = getprotobyname("tcp");
 
-	socket(SOCK, PF_INET, SOCK_STREAM, $proto)
+	socket(SOCK, PF_INET, SOCK_STREAM, 0)
 	  or die "socket failed: $!";
 
 	# As in postmaster, don't use SO_REUSEADDR on Windows
-- 
2.41.0

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Peter Eisentraut (#2)
Re: Make all Perl warnings fatal

On 2023-08-21 Mo 02:20, Peter Eisentraut wrote:

To avoid a complete bloodbath on cfbot, here is an updated patch set
that includes a workaround for the getprotobyname() issue mentioned
below.

On 10.08.23 07:58, Peter Eisentraut wrote:

We have a lot of Perl scripts in the tree, mostly code generation and
TAP tests.  Occasionally, these scripts produce warnings.  These are
AFAICT always mistakes on the developer side (true positives). 
Typical examples are warnings from genbki.pl or related when you make
a mess in the catalog files during development, or warnings from
tests when they massage a config file that looks different on
different hosts, or mistakes during merges (e.g., duplicate
subroutine definitions), or just mistakes that weren't noticed,
because, you know, there is a lot of output in a verbose build.

I wanted to figure put if we can catch these more reliably, in the
style of -Werror.  AFAICT, there is no way to automatically turn all
warnings into fatal errors.  But there is a way to do it per script,
by replacing

     use warnings;

by

     use warnings FATAL => 'all';

See attached patch to try it out.

The documentation at
<https://perldoc.perl.org/warnings#Fatal-Warnings&gt; appears to sort of
hand-wave against doing that.  Their argument appears to be something
like, the modules you use might in the future produce additional
warnings, thus breaking your scripts.  On balance, I'd take that
risk, if it means I would notice the warnings in a more timely and
robust way.  But that's just me at a moment in time.

Thoughts?

It's not really the same as -Werror, because many warnings can be
generated at runtime rather than compile-time.

Still, I guess that might not matter too much since apart from plperl we
only use perl for building / testing.

Regarding the dangers mentioned, I guess we can undo it if it proves a
nuisance.

+1 to getting rid if the unnecessary call to getprotobyname().

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

#4Michael Paquier
michael@paquier.xyz
In reply to: Andrew Dunstan (#3)
Re: Make all Perl warnings fatal

On Mon, Aug 21, 2023 at 11:51:24AM -0400, Andrew Dunstan wrote:

It's not really the same as -Werror, because many warnings can be generated
at runtime rather than compile-time.

Still, I guess that might not matter too much since apart from plperl we
only use perl for building / testing.

However, is it possible to trust the out-of-core perl modules posted
on CPAN, assuming that these will never produce warnings? I've never
seen any issues with IPC::Run in these last years, so perhaps that's
OK in the long-run.

Regarding the dangers mentioned, I guess we can undo it if it proves a
nuisance.

Yeah. I am wondering what the buildfarm would say with this change.

+1 to getting rid if the unnecessary call to getprotobyname().

Looking around here..
https://perldoc.perl.org/perlipc#Sockets%3A-Client%2FServer-Communication

Hmm. Are you sure that this is OK even in the case where the TAP
tests run on Windows without unix-domain socket support? The CI runs
on Windows, but always with unix domain sockets around as far as I
know.
--
Michael

#5Andrew Dunstan
andrew@dunslane.net
In reply to: Michael Paquier (#4)
Re: Make all Perl warnings fatal

On 2023-08-22 Tu 00:05, Michael Paquier wrote:

On Mon, Aug 21, 2023 at 11:51:24AM -0400, Andrew Dunstan wrote:

It's not really the same as -Werror, because many warnings can be generated
at runtime rather than compile-time.

Still, I guess that might not matter too much since apart from plperl we
only use perl for building / testing.

However, is it possible to trust the out-of-core perl modules posted
on CPAN, assuming that these will never produce warnings? I've never
seen any issues with IPC::Run in these last years, so perhaps that's
OK in the long-run.

If we do find any such issues then warnings can be turned off locally.
We already do that in several places.

Regarding the dangers mentioned, I guess we can undo it if it proves a
nuisance.

Yeah. I am wondering what the buildfarm would say with this change.

+1 to getting rid if the unnecessary call to getprotobyname().

Looking around here..
https://perldoc.perl.org/perlipc#Sockets%3A-Client%2FServer-Communication

Hmm. Are you sure that this is OK even in the case where the TAP
tests run on Windows without unix-domain socket support? The CI runs
on Windows, but always with unix domain sockets around as far as I
know.

The socket call in question is for a PF_INET socket, so this has nothing
at all to do with unix domain sockets. See the man page for socket() (2)
for an explanation of why 0 is ok in this case. (There's only one
protocol that matches the rest of the parameters).

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

#6Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Peter Eisentraut (#1)
Re: Make all Perl warnings fatal

On 2023-Aug-10, Peter Eisentraut wrote:

I wanted to figure put if we can catch these more reliably, in the style of
-Werror. AFAICT, there is no way to automatically turn all warnings into
fatal errors. But there is a way to do it per script, by replacing

use warnings;

by

use warnings FATAL => 'all';

See attached patch to try it out.

BTW in case we do find that there's some unforeseen problem and we want
to roll back, it would be great to have a way to disable this without
having to edit every single Perl file again later. However, I didn't
find a way to do it -- I thought about creating a separate PgWarnings.pm
file that would do the "use warnings FATAL => 'all'" dance and which
every other Perl file would use or include; but couldn't make it work.
Maybe some Perl expert knows a good answer to this.

Maybe the BEGIN block of each file can `eval` a new PgWarnings.pm that
emits the "use warnings" line?

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"No renuncies a nada. No te aferres a nada."

#7Andrew Dunstan
andrew@dunslane.net
In reply to: Alvaro Herrera (#6)
Re: Make all Perl warnings fatal

On 2023-08-22 Tu 09:20, Alvaro Herrera wrote:

On 2023-Aug-10, Peter Eisentraut wrote:

I wanted to figure put if we can catch these more reliably, in the style of
-Werror. AFAICT, there is no way to automatically turn all warnings into
fatal errors. But there is a way to do it per script, by replacing

use warnings;

by

use warnings FATAL => 'all';

See attached patch to try it out.

BTW in case we do find that there's some unforeseen problem and we want
to roll back, it would be great to have a way to disable this without
having to edit every single Perl file again later. However, I didn't
find a way to do it -- I thought about creating a separate PgWarnings.pm
file that would do the "use warnings FATAL => 'all'" dance and which
every other Perl file would use or include; but couldn't make it work.
Maybe some Perl expert knows a good answer to this.

Maybe the BEGIN block of each file can `eval` a new PgWarnings.pm that
emits the "use warnings" line?

Once we try it, I doubt we would want to revoke it globally, and if we
did I'd rather not be left with a wart like this. As I mentioned
upthread, it is possible to override the setting locally. The manual
page for the warnings pragma contains details.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

#8Peter Eisentraut
peter@eisentraut.org
In reply to: Andrew Dunstan (#3)
Re: Make all Perl warnings fatal

On 21.08.23 17:51, Andrew Dunstan wrote:

Still, I guess that might not matter too much since apart from plperl we
only use perl for building / testing.

Regarding the dangers mentioned, I guess we can undo it if it proves a
nuisance.

+1 to getting rid if the unnecessary call to getprotobyname().

I have committed the latter part.

The rest would still depend on some fixes for the MSVC build system, so
I'll hold that until we decide what to do with that.

In reply to: Alvaro Herrera (#6)
Re: Make all Perl warnings fatal

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:

On 2023-Aug-10, Peter Eisentraut wrote:

I wanted to figure put if we can catch these more reliably, in the style of
-Werror. AFAICT, there is no way to automatically turn all warnings into
fatal errors. But there is a way to do it per script, by replacing

use warnings;

by

use warnings FATAL => 'all';

See attached patch to try it out.

BTW in case we do find that there's some unforeseen problem and we want
to roll back, it would be great to have a way to disable this without
having to edit every single Perl file again later. However, I didn't
find a way to do it -- I thought about creating a separate PgWarnings.pm
file that would do the "use warnings FATAL => 'all'" dance and which
every other Perl file would use or include; but couldn't make it work.
Maybe some Perl expert knows a good answer to this.

Like most pragmas (all-lower-case module names), `warnings` affects the
currently-compiling lexical scope, so to have a module like PgWarnings
inject it into the module that uses it, you'd call warnings->import in
its import method (which gets called when the `use PgWarnings;``
statement is compiled, e.g.:

package PgWarnings;

sub import {
warnings->import(FATAL => 'all');
}

I wouldn't bother with a whole module just for that, but if we have a
group of pragmas or modules we always want to enable/import and have the
ability to change this set without having to edit all the files, it's
quite common to have a ProjectName::Policy module that does that. For
example, to exclude warnings that are unsafe, pointless, or impossible
to fatalise (c.f. https://metacpan.org/pod/strictures#CATEGORY-SELECTIONS):

package PostgreSQL::Policy;

sub import {
strict->import;
warnings->import(
FATAL => 'all',
NONFATAL => qw(exec internal malloc recursion),
);
warnings->uniport(qw(once));
}

Now that we require Perl 5.14, we might want to consider enabling its
feature bundle as well, with:

feature->import(':5.14')

Although the only features of note that adds are:

- say: the `say` function, like `print` but appends a newline

- state: `state` variables, like `my` but only initialised the first
time the function they're in is called, and the value persists
between calls (like function-scoped `static` variables in C)

- unicode_strings: use unicode semantics for characters in the
128-255 range, regardless of internal representation

Maybe the BEGIN block of each file can `eval` a new PgWarnings.pm that
emits the "use warnings" line?

That's ugly as sin, and thankfully not necessary.

-ilmari

#10Andrew Dunstan
andrew@dunslane.net
In reply to: Dagfinn Ilmari Mannsåker (#9)
Re: Make all Perl warnings fatal

On 2023-08-25 Fr 16:49, Dagfinn Ilmari Mannsåker wrote:

Alvaro Herrera<alvherre@alvh.no-ip.org> writes:

On 2023-Aug-10, Peter Eisentraut wrote:

I wanted to figure put if we can catch these more reliably, in the style of
-Werror. AFAICT, there is no way to automatically turn all warnings into
fatal errors. But there is a way to do it per script, by replacing

use warnings;

by

use warnings FATAL => 'all';

See attached patch to try it out.

BTW in case we do find that there's some unforeseen problem and we want
to roll back, it would be great to have a way to disable this without
having to edit every single Perl file again later. However, I didn't
find a way to do it -- I thought about creating a separate PgWarnings.pm
file that would do the "use warnings FATAL => 'all'" dance and which
every other Perl file would use or include; but couldn't make it work.
Maybe some Perl expert knows a good answer to this.

Like most pragmas (all-lower-case module names), `warnings` affects the
currently-compiling lexical scope, so to have a module like PgWarnings
inject it into the module that uses it, you'd call warnings->import in
its import method (which gets called when the `use PgWarnings;``
statement is compiled, e.g.:

package PgWarnings;

sub import {
warnings->import(FATAL => 'all');
}

I wouldn't bother with a whole module just for that, but if we have a
group of pragmas or modules we always want to enable/import and have the
ability to change this set without having to edit all the files, it's
quite common to have a ProjectName::Policy module that does that. For
example, to exclude warnings that are unsafe, pointless, or impossible
to fatalise (c.f.https://metacpan.org/pod/strictures#CATEGORY-SELECTIONS):

package PostgreSQL::Policy;

sub import {
strict->import;
warnings->import(
FATAL => 'all',
NONFATAL => qw(exec internal malloc recursion),
);
warnings->uniport(qw(once));
}

Now that we require Perl 5.14, we might want to consider enabling its
feature bundle as well, with:

feature->import(':5.14')

Although the only features of note that adds are:

- say: the `say` function, like `print` but appends a newline

- state: `state` variables, like `my` but only initialised the first
time the function they're in is called, and the value persists
between calls (like function-scoped `static` variables in C)

- unicode_strings: use unicode semantics for characters in the
128-255 range, regardless of internal representation

We'd probably have to modify the perlcritic rules to account for it. See
<https://metacpan.org/pod/Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict&gt;
and similarly for RequireUseWarnings. In any case, it seems a bit like
overkill.

Maybe the BEGIN block of each file can `eval` a new PgWarnings.pm that
emits the "use warnings" line?

That's ugly as sin, and thankfully not necessary.

Agreed.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

#11Peter Eisentraut
peter@eisentraut.org
In reply to: Peter Eisentraut (#1)
Re: Make all Perl warnings fatal

On 10.08.23 07:58, Peter Eisentraut wrote:

There are also a couple of issues in the MSVC legacy build system that
would need to be tightened up in order to survive with fatal Perl
warnings.  Obviously, there is a question whether it's worth spending
any time on that anymore.

It looks like there are no principled objections to the overall idea
here, but given this dependency on the MSVC build system removal, I'm
going to set this patch to Returned with feedback for now.

#12Peter Eisentraut
peter@eisentraut.org
In reply to: Peter Eisentraut (#11)
2 attachment(s)
Re: Make all Perl warnings fatal

On 12.09.23 07:42, Peter Eisentraut wrote:

On 10.08.23 07:58, Peter Eisentraut wrote:

There are also a couple of issues in the MSVC legacy build system that
would need to be tightened up in order to survive with fatal Perl
warnings.  Obviously, there is a question whether it's worth spending
any time on that anymore.

It looks like there are no principled objections to the overall idea
here, but given this dependency on the MSVC build system removal, I'm
going to set this patch to Returned with feedback for now.

Now that that is done, here is an updated patch for this.

I found one more bug in the Perl code because of this, a fix for which
is included here.

With this fix, this passes all the CI tests on all platforms.

Attachments:

v3-0001-Fix-warning-in-Perl-test-code.patchtext/plain; charset=UTF-8; name=v3-0001-Fix-warning-in-Perl-test-code.patchDownload
From 355f54957d7cbe7e0d12be17262444a471e373c7 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 20 Dec 2023 10:07:03 +0100
Subject: [PATCH v3 1/2] Fix warning in Perl test code

The code was passing a scalar argument to node->restart(), but it was
expecting a hash, which causes a warning from Perl.

But the node->restart() function doesn't take a mode argument anyway.
This was probably copied from an incorrect comment (see commit
750c59d7ec).  The default restart mode is "fast" anyway, so the test
should still be semantically correct without explicitly specifying the
mode.
---
 src/test/recovery/t/006_logical_decoding.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl
index 5025d65b1b..5c851bf4c1 100644
--- a/src/test/recovery/t/006_logical_decoding.pl
+++ b/src/test/recovery/t/006_logical_decoding.pl
@@ -70,7 +70,7 @@
 # If we immediately crash the server we might lose the progress we just made
 # and replay the same changes again. But a clean shutdown should never repeat
 # the same changes when we use the SQL decoding interface.
-$node_primary->restart('fast');
+$node_primary->restart;
 
 # There are no new writes, so the result should be empty.
 $result = $node_primary->safe_psql('postgres',
-- 
2.43.0

v3-0002-Make-all-Perl-warnings-fatal.patchtext/plain; charset=UTF-8; name=v3-0002-Make-all-Perl-warnings-fatal.patchDownload
From e2bf026cbb3901286d2d552686ce941f79f1efc7 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 20 Dec 2023 08:23:17 +0100
Subject: [PATCH v3 2/2] Make all Perl warnings fatal

Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org
---
 config/check_modules.pl                                     | 2 +-
 contrib/amcheck/t/001_verify_heapam.pl                      | 2 +-
 contrib/amcheck/t/002_cic.pl                                | 2 +-
 contrib/amcheck/t/003_cic_2pc.pl                            | 2 +-
 contrib/amcheck/t/004_verify_nbtree_unique.pl               | 2 +-
 contrib/amcheck/t/005_pitr.pl                               | 2 +-
 contrib/auto_explain/t/001_auto_explain.pl                  | 2 +-
 contrib/basebackup_to_shell/t/001_basic.pl                  | 2 +-
 contrib/bloom/t/001_wal.pl                                  | 2 +-
 contrib/fuzzystrmatch/daitch_mokotoff_header.pl             | 2 +-
 contrib/intarray/bench/bench.pl                             | 2 +-
 contrib/intarray/bench/create_test.pl                       | 2 +-
 contrib/oid2name/t/001_basic.pl                             | 2 +-
 contrib/pg_prewarm/t/001_basic.pl                           | 2 +-
 contrib/seg/seg-validate.pl                                 | 2 +-
 contrib/seg/sort-segments.pl                                | 2 +-
 contrib/test_decoding/t/001_repl_stats.pl                   | 2 +-
 contrib/vacuumlo/t/001_basic.pl                             | 2 +-
 doc/src/sgml/generate-errcodes-table.pl                     | 2 +-
 doc/src/sgml/generate-keywords-table.pl                     | 2 +-
 doc/src/sgml/generate-targets-meson.pl                      | 2 +-
 doc/src/sgml/mk_feature_tables.pl                           | 2 +-
 src/backend/catalog/Catalog.pm                              | 2 +-
 src/backend/catalog/genbki.pl                               | 2 +-
 src/backend/nodes/gen_node_support.pl                       | 2 +-
 src/backend/parser/check_keywords.pl                        | 2 +-
 src/backend/snowball/snowball_create.pl                     | 2 +-
 src/backend/storage/lmgr/generate-lwlocknames.pl            | 2 +-
 src/backend/utils/Gen_dummy_probes.pl                       | 2 +-
 src/backend/utils/Gen_fmgrtab.pl                            | 2 +-
 src/backend/utils/activity/generate-wait_event_types.pl     | 2 +-
 src/backend/utils/generate-errcodes.pl                      | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_BIG5.pl                 | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl               | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl         | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl               | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl               | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl               | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_GB18030.pl              | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl                | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl       | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_SJIS.pl                 | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_UHC.pl                  | 2 +-
 src/backend/utils/mb/Unicode/UCS_to_most.pl                 | 2 +-
 src/backend/utils/mb/Unicode/convutils.pm                   | 2 +-
 src/bin/initdb/t/001_initdb.pl                              | 2 +-
 src/bin/pg_amcheck/t/001_basic.pl                           | 2 +-
 src/bin/pg_amcheck/t/002_nonesuch.pl                        | 2 +-
 src/bin/pg_amcheck/t/003_check.pl                           | 2 +-
 src/bin/pg_amcheck/t/004_verify_heapam.pl                   | 2 +-
 src/bin/pg_amcheck/t/005_opclass_damage.pl                  | 2 +-
 src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl        | 2 +-
 src/bin/pg_basebackup/t/010_pg_basebackup.pl                | 2 +-
 src/bin/pg_basebackup/t/011_in_place_tablespace.pl          | 2 +-
 src/bin/pg_basebackup/t/020_pg_receivewal.pl                | 2 +-
 src/bin/pg_basebackup/t/030_pg_recvlogical.pl               | 2 +-
 src/bin/pg_checksums/t/001_basic.pl                         | 2 +-
 src/bin/pg_checksums/t/002_actions.pl                       | 2 +-
 src/bin/pg_config/t/001_pg_config.pl                        | 2 +-
 src/bin/pg_controldata/t/001_pg_controldata.pl              | 2 +-
 src/bin/pg_ctl/t/001_start_stop.pl                          | 2 +-
 src/bin/pg_ctl/t/002_status.pl                              | 2 +-
 src/bin/pg_ctl/t/003_promote.pl                             | 2 +-
 src/bin/pg_ctl/t/004_logrotate.pl                           | 2 +-
 src/bin/pg_dump/t/001_basic.pl                              | 2 +-
 src/bin/pg_dump/t/002_pg_dump.pl                            | 2 +-
 src/bin/pg_dump/t/003_pg_dump_with_server.pl                | 2 +-
 src/bin/pg_dump/t/004_pg_dump_parallel.pl                   | 2 +-
 src/bin/pg_dump/t/005_pg_dump_filterfile.pl                 | 2 +-
 src/bin/pg_dump/t/010_dump_connstr.pl                       | 2 +-
 src/bin/pg_resetwal/t/001_basic.pl                          | 2 +-
 src/bin/pg_resetwal/t/002_corrupted.pl                      | 2 +-
 src/bin/pg_rewind/t/001_basic.pl                            | 2 +-
 src/bin/pg_rewind/t/002_databases.pl                        | 2 +-
 src/bin/pg_rewind/t/003_extrafiles.pl                       | 2 +-
 src/bin/pg_rewind/t/004_pg_xlog_symlink.pl                  | 2 +-
 src/bin/pg_rewind/t/005_same_timeline.pl                    | 2 +-
 src/bin/pg_rewind/t/006_options.pl                          | 2 +-
 src/bin/pg_rewind/t/007_standby_source.pl                   | 2 +-
 src/bin/pg_rewind/t/008_min_recovery_point.pl               | 2 +-
 src/bin/pg_rewind/t/009_growing_files.pl                    | 2 +-
 src/bin/pg_rewind/t/RewindTest.pm                           | 2 +-
 src/bin/pg_test_fsync/t/001_basic.pl                        | 2 +-
 src/bin/pg_test_timing/t/001_basic.pl                       | 2 +-
 src/bin/pg_upgrade/t/001_basic.pl                           | 2 +-
 src/bin/pg_upgrade/t/002_pg_upgrade.pl                      | 2 +-
 src/bin/pg_upgrade/t/003_logical_slots.pl                   | 2 +-
 src/bin/pg_verifybackup/t/001_basic.pl                      | 2 +-
 src/bin/pg_verifybackup/t/002_algorithm.pl                  | 2 +-
 src/bin/pg_verifybackup/t/003_corruption.pl                 | 2 +-
 src/bin/pg_verifybackup/t/004_options.pl                    | 2 +-
 src/bin/pg_verifybackup/t/005_bad_manifest.pl               | 2 +-
 src/bin/pg_verifybackup/t/006_encoding.pl                   | 2 +-
 src/bin/pg_verifybackup/t/007_wal.pl                        | 2 +-
 src/bin/pg_verifybackup/t/008_untar.pl                      | 2 +-
 src/bin/pg_verifybackup/t/009_extract.pl                    | 2 +-
 src/bin/pg_verifybackup/t/010_client_untar.pl               | 2 +-
 src/bin/pg_waldump/t/001_basic.pl                           | 2 +-
 src/bin/pg_waldump/t/002_save_fullpage.pl                   | 2 +-
 src/bin/pgbench/t/001_pgbench_with_server.pl                | 2 +-
 src/bin/pgbench/t/002_pgbench_no_server.pl                  | 2 +-
 src/bin/psql/create_help.pl                                 | 2 +-
 src/bin/psql/t/001_basic.pl                                 | 2 +-
 src/bin/psql/t/010_tab_completion.pl                        | 2 +-
 src/bin/psql/t/020_cancel.pl                                | 2 +-
 src/bin/scripts/t/010_clusterdb.pl                          | 2 +-
 src/bin/scripts/t/011_clusterdb_all.pl                      | 2 +-
 src/bin/scripts/t/020_createdb.pl                           | 2 +-
 src/bin/scripts/t/040_createuser.pl                         | 2 +-
 src/bin/scripts/t/050_dropdb.pl                             | 2 +-
 src/bin/scripts/t/070_dropuser.pl                           | 2 +-
 src/bin/scripts/t/080_pg_isready.pl                         | 2 +-
 src/bin/scripts/t/090_reindexdb.pl                          | 2 +-
 src/bin/scripts/t/091_reindexdb_all.pl                      | 2 +-
 src/bin/scripts/t/100_vacuumdb.pl                           | 2 +-
 src/bin/scripts/t/101_vacuumdb_all.pl                       | 2 +-
 src/bin/scripts/t/102_vacuumdb_stages.pl                    | 2 +-
 src/bin/scripts/t/200_connstr.pl                            | 2 +-
 src/common/unicode/generate-norm_test_table.pl              | 2 +-
 src/common/unicode/generate-unicode_category_table.pl       | 2 +-
 src/common/unicode/generate-unicode_east_asian_fw_table.pl  | 2 +-
 src/common/unicode/generate-unicode_nonspacing_table.pl     | 2 +-
 src/common/unicode/generate-unicode_norm_table.pl           | 2 +-
 src/common/unicode/generate-unicode_normprops_table.pl      | 2 +-
 src/common/unicode/generate-unicode_version.pl              | 2 +-
 src/include/catalog/duplicate_oids                          | 2 +-
 src/include/catalog/reformat_dat_file.pl                    | 2 +-
 src/include/catalog/renumber_oids.pl                        | 2 +-
 src/include/catalog/unused_oids                             | 2 +-
 src/interfaces/ecpg/preproc/check_rules.pl                  | 2 +-
 src/interfaces/ecpg/preproc/parse.pl                        | 2 +-
 src/interfaces/libpq/t/001_uri.pl                           | 2 +-
 src/interfaces/libpq/t/002_api.pl                           | 2 +-
 src/interfaces/libpq/t/003_load_balance_host_list.pl        | 2 +-
 src/interfaces/libpq/t/004_load_balance_dns.pl              | 2 +-
 src/pl/plperl/plc_perlboot.pl                               | 6 +++---
 src/pl/plperl/plperl_opmask.pl                              | 2 +-
 src/pl/plperl/text2macro.pl                                 | 2 +-
 src/pl/plpgsql/src/generate-plerrcodes.pl                   | 2 +-
 src/pl/plpython/generate-spiexceptions.pl                   | 2 +-
 src/pl/tcl/generate-pltclerrcodes.pl                        | 2 +-
 src/test/authentication/t/001_password.pl                   | 2 +-
 src/test/authentication/t/002_saslprep.pl                   | 2 +-
 src/test/authentication/t/003_peer.pl                       | 2 +-
 src/test/authentication/t/004_file_inclusion.pl             | 2 +-
 src/test/authentication/t/005_sspi.pl                       | 2 +-
 src/test/authentication/t/006_login_trigger.pl              | 2 +-
 src/test/icu/t/010_database.pl                              | 2 +-
 src/test/kerberos/t/001_auth.pl                             | 2 +-
 src/test/ldap/LdapServer.pm                                 | 2 +-
 src/test/ldap/t/001_auth.pl                                 | 2 +-
 src/test/ldap/t/002_bindpasswd.pl                           | 2 +-
 src/test/locale/sort-test.pl                                | 2 +-
 src/test/modules/brin/t/01_workitems.pl                     | 2 +-
 src/test/modules/brin/t/02_wal_consistency.pl               | 2 +-
 src/test/modules/commit_ts/t/001_base.pl                    | 2 +-
 src/test/modules/commit_ts/t/002_standby.pl                 | 2 +-
 src/test/modules/commit_ts/t/003_standby_2.pl               | 2 +-
 src/test/modules/commit_ts/t/004_restart.pl                 | 2 +-
 .../modules/ldap_password_func/t/001_mutated_bindpasswd.pl  | 2 +-
 src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl     | 2 +-
 src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl  | 2 +-
 src/test/modules/test_custom_rmgrs/t/001_basic.pl           | 2 +-
 src/test/modules/test_misc/t/001_constraint_validation.pl   | 2 +-
 src/test/modules/test_misc/t/002_tablespace.pl              | 2 +-
 src/test/modules/test_misc/t/003_check_guc.pl               | 2 +-
 src/test/modules/test_misc/t/004_io_direct.pl               | 2 +-
 src/test/modules/test_pg_dump/t/001_base.pl                 | 2 +-
 src/test/modules/worker_spi/t/001_worker_spi.pl             | 2 +-
 src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl   | 2 +-
 src/test/modules/xid_wraparound/t/002_limits.pl             | 2 +-
 src/test/modules/xid_wraparound/t/003_wraparounds.pl        | 2 +-
 src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm              | 2 +-
 src/test/perl/PostgreSQL/Test/BackgroundPsql.pm             | 2 +-
 src/test/perl/PostgreSQL/Test/Cluster.pm                    | 2 +-
 src/test/perl/PostgreSQL/Test/RecursiveCopy.pm              | 2 +-
 src/test/perl/PostgreSQL/Test/SimpleTee.pm                  | 2 +-
 src/test/perl/PostgreSQL/Test/Utils.pm                      | 2 +-
 src/test/perl/PostgreSQL/Version.pm                         | 2 +-
 src/test/perl/README                                        | 2 +-
 src/test/recovery/t/001_stream_rep.pl                       | 2 +-
 src/test/recovery/t/002_archiving.pl                        | 2 +-
 src/test/recovery/t/003_recovery_targets.pl                 | 2 +-
 src/test/recovery/t/004_timeline_switch.pl                  | 2 +-
 src/test/recovery/t/005_replay_delay.pl                     | 2 +-
 src/test/recovery/t/006_logical_decoding.pl                 | 2 +-
 src/test/recovery/t/007_sync_rep.pl                         | 2 +-
 src/test/recovery/t/008_fsm_truncation.pl                   | 2 +-
 src/test/recovery/t/009_twophase.pl                         | 2 +-
 src/test/recovery/t/010_logical_decoding_timelines.pl       | 2 +-
 src/test/recovery/t/012_subtransactions.pl                  | 2 +-
 src/test/recovery/t/013_crash_restart.pl                    | 2 +-
 src/test/recovery/t/014_unlogged_reinit.pl                  | 2 +-
 src/test/recovery/t/015_promotion_pages.pl                  | 2 +-
 src/test/recovery/t/016_min_consistency.pl                  | 2 +-
 src/test/recovery/t/017_shm.pl                              | 2 +-
 src/test/recovery/t/018_wal_optimize.pl                     | 2 +-
 src/test/recovery/t/019_replslot_limit.pl                   | 2 +-
 src/test/recovery/t/020_archive_status.pl                   | 2 +-
 src/test/recovery/t/021_row_visibility.pl                   | 2 +-
 src/test/recovery/t/022_crash_temp_files.pl                 | 2 +-
 src/test/recovery/t/023_pitr_prepared_xact.pl               | 2 +-
 src/test/recovery/t/024_archive_recovery.pl                 | 2 +-
 src/test/recovery/t/025_stuck_on_old_timeline.pl            | 2 +-
 src/test/recovery/t/026_overwrite_contrecord.pl             | 2 +-
 src/test/recovery/t/027_stream_regress.pl                   | 2 +-
 src/test/recovery/t/028_pitr_timelines.pl                   | 2 +-
 src/test/recovery/t/029_stats_restart.pl                    | 2 +-
 src/test/recovery/t/030_stats_cleanup_replica.pl            | 2 +-
 src/test/recovery/t/031_recovery_conflict.pl                | 2 +-
 src/test/recovery/t/032_relfilenode_reuse.pl                | 2 +-
 src/test/recovery/t/033_replay_tsp_drops.pl                 | 2 +-
 src/test/recovery/t/034_create_database.pl                  | 2 +-
 src/test/recovery/t/035_standby_logical_decoding.pl         | 2 +-
 src/test/recovery/t/036_truncated_dropped.pl                | 2 +-
 src/test/recovery/t/037_invalid_database.pl                 | 2 +-
 src/test/recovery/t/038_save_logical_slots_shutdown.pl      | 2 +-
 src/test/recovery/t/039_end_of_wal.pl                       | 2 +-
 src/test/recovery/t/cp_history_files                        | 2 +-
 src/test/ssl/t/001_ssltests.pl                              | 4 +++-
 src/test/ssl/t/002_scram.pl                                 | 2 +-
 src/test/ssl/t/003_sslinfo.pl                               | 2 +-
 src/test/ssl/t/SSL/Backend/OpenSSL.pm                       | 2 +-
 src/test/ssl/t/SSL/Server.pm                                | 2 +-
 src/test/subscription/t/001_rep_changes.pl                  | 2 +-
 src/test/subscription/t/002_types.pl                        | 2 +-
 src/test/subscription/t/003_constraints.pl                  | 2 +-
 src/test/subscription/t/004_sync.pl                         | 2 +-
 src/test/subscription/t/005_encoding.pl                     | 2 +-
 src/test/subscription/t/006_rewrite.pl                      | 2 +-
 src/test/subscription/t/007_ddl.pl                          | 2 +-
 src/test/subscription/t/008_diff_schema.pl                  | 2 +-
 src/test/subscription/t/009_matviews.pl                     | 2 +-
 src/test/subscription/t/010_truncate.pl                     | 2 +-
 src/test/subscription/t/011_generated.pl                    | 2 +-
 src/test/subscription/t/012_collation.pl                    | 2 +-
 src/test/subscription/t/013_partition.pl                    | 2 +-
 src/test/subscription/t/014_binary.pl                       | 2 +-
 src/test/subscription/t/015_stream.pl                       | 2 +-
 src/test/subscription/t/016_stream_subxact.pl               | 2 +-
 src/test/subscription/t/017_stream_ddl.pl                   | 2 +-
 src/test/subscription/t/018_stream_subxact_abort.pl         | 2 +-
 src/test/subscription/t/019_stream_subxact_ddl_abort.pl     | 2 +-
 src/test/subscription/t/020_messages.pl                     | 2 +-
 src/test/subscription/t/021_twophase.pl                     | 2 +-
 src/test/subscription/t/022_twophase_cascade.pl             | 2 +-
 src/test/subscription/t/023_twophase_stream.pl              | 2 +-
 src/test/subscription/t/024_add_drop_pub.pl                 | 2 +-
 src/test/subscription/t/025_rep_changes_for_schema.pl       | 2 +-
 src/test/subscription/t/026_stats.pl                        | 2 +-
 src/test/subscription/t/027_nosuperuser.pl                  | 2 +-
 src/test/subscription/t/028_row_filter.pl                   | 2 +-
 src/test/subscription/t/029_on_error.pl                     | 2 +-
 src/test/subscription/t/030_origin.pl                       | 2 +-
 src/test/subscription/t/031_column_list.pl                  | 2 +-
 src/test/subscription/t/032_subscribe_use_index.pl          | 2 +-
 src/test/subscription/t/033_run_as_table_owner.pl           | 2 +-
 src/test/subscription/t/100_bugs.pl                         | 2 +-
 src/tools/PerfectHash.pm                                    | 2 +-
 src/tools/check_bison_recursion.pl                          | 2 +-
 src/tools/ci/windows_build_config.pl                        | 2 +-
 src/tools/copyright.pl                                      | 2 +-
 src/tools/fix-old-flex-code.pl                              | 2 +-
 src/tools/gen_export.pl                                     | 2 +-
 src/tools/gen_keywordlist.pl                                | 2 +-
 src/tools/git_changelog                                     | 2 +-
 src/tools/mark_pgdllimport.pl                               | 2 +-
 src/tools/msvc_gendef.pl                                    | 2 +-
 src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl              | 2 +-
 src/tools/pginclude/pgcheckdefines                          | 2 +-
 src/tools/pgindent/pgindent                                 | 2 +-
 src/tools/version_stamp.pl                                  | 2 +-
 src/tools/win32tzlist.pl                                    | 2 +-
 273 files changed, 277 insertions(+), 275 deletions(-)

diff --git a/config/check_modules.pl b/config/check_modules.pl
index 611f3a673f..1599abcc0b 100644
--- a/config/check_modules.pl
+++ b/config/check_modules.pl
@@ -5,7 +5,7 @@
 # but specify them anyway for documentation's sake.)
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config;
 
 use IPC::Run 0.79;
diff --git a/contrib/amcheck/t/001_verify_heapam.pl b/contrib/amcheck/t/001_verify_heapam.pl
index 46d5b53181..c9caa48169 100644
--- a/contrib/amcheck/t/001_verify_heapam.pl
+++ b/contrib/amcheck/t/001_verify_heapam.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/amcheck/t/002_cic.pl b/contrib/amcheck/t/002_cic.pl
index 42a047a357..f0b5d8f7e4 100644
--- a/contrib/amcheck/t/002_cic.pl
+++ b/contrib/amcheck/t/002_cic.pl
@@ -3,7 +3,7 @@
 
 # Test CREATE INDEX CONCURRENTLY with concurrent modifications
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/amcheck/t/003_cic_2pc.pl b/contrib/amcheck/t/003_cic_2pc.pl
index 3279a2505a..a5eb2d9d69 100644
--- a/contrib/amcheck/t/003_cic_2pc.pl
+++ b/contrib/amcheck/t/003_cic_2pc.pl
@@ -3,7 +3,7 @@
 
 # Test CREATE INDEX CONCURRENTLY with concurrent prepared-xact modifications
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/amcheck/t/004_verify_nbtree_unique.pl b/contrib/amcheck/t/004_verify_nbtree_unique.pl
index b999ab9c17..cb36320986 100644
--- a/contrib/amcheck/t/004_verify_nbtree_unique.pl
+++ b/contrib/amcheck/t/004_verify_nbtree_unique.pl
@@ -5,7 +5,7 @@
 # presence of breaking sort order changes.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/contrib/amcheck/t/005_pitr.pl b/contrib/amcheck/t/005_pitr.pl
index 6bcc1596f2..aece77317e 100644
--- a/contrib/amcheck/t/005_pitr.pl
+++ b/contrib/amcheck/t/005_pitr.pl
@@ -2,7 +2,7 @@
 
 # Test integrity of intermediate states by PITR to those states
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/contrib/auto_explain/t/001_auto_explain.pl b/contrib/auto_explain/t/001_auto_explain.pl
index abb422f8de..2720215dbc 100644
--- a/contrib/auto_explain/t/001_auto_explain.pl
+++ b/contrib/auto_explain/t/001_auto_explain.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/basebackup_to_shell/t/001_basic.pl b/contrib/basebackup_to_shell/t/001_basic.pl
index e2cdd2ecb0..221f5b2296 100644
--- a/contrib/basebackup_to_shell/t/001_basic.pl
+++ b/contrib/basebackup_to_shell/t/001_basic.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/bloom/t/001_wal.pl b/contrib/bloom/t/001_wal.pl
index 2a69ff1a74..7e8c2b1a3d 100644
--- a/contrib/bloom/t/001_wal.pl
+++ b/contrib/bloom/t/001_wal.pl
@@ -3,7 +3,7 @@
 
 # Test generic xlog record work for bloom index replication.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/contrib/fuzzystrmatch/daitch_mokotoff_header.pl b/contrib/fuzzystrmatch/daitch_mokotoff_header.pl
index 51a40e7748..5ee0d1cc7c 100755
--- a/contrib/fuzzystrmatch/daitch_mokotoff_header.pl
+++ b/contrib/fuzzystrmatch/daitch_mokotoff_header.pl
@@ -9,7 +9,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 die "Usage: $0 OUTPUT_FILE\n" if @ARGV != 1;
 my $output_file = $ARGV[0];
diff --git a/contrib/intarray/bench/bench.pl b/contrib/intarray/bench/bench.pl
index 067654986e..ba8163ce11 100755
--- a/contrib/intarray/bench/bench.pl
+++ b/contrib/intarray/bench/bench.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # make sure we are in a sane environment.
 use DBI();
diff --git a/contrib/intarray/bench/create_test.pl b/contrib/intarray/bench/create_test.pl
index 6efe9151ca..f6ffc5b452 100755
--- a/contrib/intarray/bench/create_test.pl
+++ b/contrib/intarray/bench/create_test.pl
@@ -5,7 +5,7 @@
 # contrib/intarray/bench/create_test.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print <<EOT;
 create table message (
diff --git a/contrib/oid2name/t/001_basic.pl b/contrib/oid2name/t/001_basic.pl
index 74fe622916..ac361a0139 100644
--- a/contrib/oid2name/t/001_basic.pl
+++ b/contrib/oid2name/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/contrib/pg_prewarm/t/001_basic.pl b/contrib/pg_prewarm/t/001_basic.pl
index 6b7c869afc..b2f86c1a25 100644
--- a/contrib/pg_prewarm/t/001_basic.pl
+++ b/contrib/pg_prewarm/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/seg/seg-validate.pl b/contrib/seg/seg-validate.pl
index 67c0015e6b..b21af13140 100755
--- a/contrib/seg/seg-validate.pl
+++ b/contrib/seg/seg-validate.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $integer = '[+-]?[0-9]+';
 my $real = '[+-]?[0-9]+\.[0-9]+';
diff --git a/contrib/seg/sort-segments.pl b/contrib/seg/sort-segments.pl
index 3cc21a3ba0..9bd71c0391 100755
--- a/contrib/seg/sort-segments.pl
+++ b/contrib/seg/sort-segments.pl
@@ -5,7 +5,7 @@
 # this script will sort any table with the segment data type in its last column
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my @rows;
 
diff --git a/contrib/test_decoding/t/001_repl_stats.pl b/contrib/test_decoding/t/001_repl_stats.pl
index 7c2d87561c..da466bdacf 100644
--- a/contrib/test_decoding/t/001_repl_stats.pl
+++ b/contrib/test_decoding/t/001_repl_stats.pl
@@ -4,7 +4,7 @@
 # Test replication statistics data in pg_stat_replication_slots is sane after
 # drop replication slot and restart.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/contrib/vacuumlo/t/001_basic.pl b/contrib/vacuumlo/t/001_basic.pl
index 75067863de..4e6566d86b 100644
--- a/contrib/vacuumlo/t/001_basic.pl
+++ b/contrib/vacuumlo/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/doc/src/sgml/generate-errcodes-table.pl b/doc/src/sgml/generate-errcodes-table.pl
index 51f22bde95..e4df6d9ece 100644
--- a/doc/src/sgml/generate-errcodes-table.pl
+++ b/doc/src/sgml/generate-errcodes-table.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "<!-- autogenerated from src/backend/utils/errcodes.txt, do not edit -->\n";
diff --git a/doc/src/sgml/generate-keywords-table.pl b/doc/src/sgml/generate-keywords-table.pl
index ee44edaa6c..145d131670 100644
--- a/doc/src/sgml/generate-keywords-table.pl
+++ b/doc/src/sgml/generate-keywords-table.pl
@@ -5,7 +5,7 @@
 # Copyright (c) 2019-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my @sql_versions = reverse sort ('1992', '2016', '2023');
 
diff --git a/doc/src/sgml/generate-targets-meson.pl b/doc/src/sgml/generate-targets-meson.pl
index 56a94d6ead..2a371ef86f 100644
--- a/doc/src/sgml/generate-targets-meson.pl
+++ b/doc/src/sgml/generate-targets-meson.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $targets_meson_file = $ARGV[0];
 open my $targets_meson, '<', $targets_meson_file or die;
diff --git a/doc/src/sgml/mk_feature_tables.pl b/doc/src/sgml/mk_feature_tables.pl
index 824be729a0..69b1d3a1a7 100644
--- a/doc/src/sgml/mk_feature_tables.pl
+++ b/doc/src/sgml/mk_feature_tables.pl
@@ -3,7 +3,7 @@
 # doc/src/sgml/mk_feature_tables.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $yesno = $ARGV[0];
 
diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index be56cc153f..c1ba8bfd54 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -14,7 +14,7 @@
 package Catalog;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Compare;
 
diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index 380bc23c82..cde35cf242 100644
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -14,7 +14,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/backend/nodes/gen_node_support.pl b/src/backend/nodes/gen_node_support.pl
index 72c7963578..c7091d6bf2 100644
--- a/src/backend/nodes/gen_node_support.pl
+++ b/src/backend/nodes/gen_node_support.pl
@@ -16,7 +16,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 use Getopt::Long;
diff --git a/src/backend/parser/check_keywords.pl b/src/backend/parser/check_keywords.pl
index e9b6f40eaa..cc58ce88a9 100644
--- a/src/backend/parser/check_keywords.pl
+++ b/src/backend/parser/check_keywords.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2009-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $gram_filename = $ARGV[0];
 my $kwlist_filename = $ARGV[1];
diff --git a/src/backend/snowball/snowball_create.pl b/src/backend/snowball/snowball_create.pl
index 35d1cd9621..f1c5d160de 100644
--- a/src/backend/snowball/snowball_create.pl
+++ b/src/backend/snowball/snowball_create.pl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $outdir_path = '';
diff --git a/src/backend/storage/lmgr/generate-lwlocknames.pl b/src/backend/storage/lmgr/generate-lwlocknames.pl
index 863c88252b..34bac0faf5 100644
--- a/src/backend/storage/lmgr/generate-lwlocknames.pl
+++ b/src/backend/storage/lmgr/generate-lwlocknames.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $output_path = '.';
diff --git a/src/backend/utils/Gen_dummy_probes.pl b/src/backend/utils/Gen_dummy_probes.pl
index f6df82baa5..e82caae846 100644
--- a/src/backend/utils/Gen_dummy_probes.pl
+++ b/src/backend/utils/Gen_dummy_probes.pl
@@ -7,7 +7,7 @@
 #-------------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 m/^\s*probe / || next;
 s/^\s*probe ([^(]*)(.*);/$1$2/;
diff --git a/src/backend/utils/Gen_fmgrtab.pl b/src/backend/utils/Gen_fmgrtab.pl
index 764216c56d..d0f3652136 100644
--- a/src/backend/utils/Gen_fmgrtab.pl
+++ b/src/backend/utils/Gen_fmgrtab.pl
@@ -17,7 +17,7 @@
 use Catalog;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $output_path = '';
diff --git a/src/backend/utils/activity/generate-wait_event_types.pl b/src/backend/utils/activity/generate-wait_event_types.pl
index 046be2cb70..14506990a2 100644
--- a/src/backend/utils/activity/generate-wait_event_types.pl
+++ b/src/backend/utils/activity/generate-wait_event_types.pl
@@ -15,7 +15,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $output_path = '.';
diff --git a/src/backend/utils/generate-errcodes.pl b/src/backend/utils/generate-errcodes.pl
index 34d0f25c23..42730e8c1a 100644
--- a/src/backend/utils/generate-errcodes.pl
+++ b/src/backend/utils/generate-errcodes.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $outfile = '';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl b/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
index 4c5724b8b7..41fe881e1b 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
@@ -25,7 +25,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
index f9ff2bd3d2..a14e4ac820 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
@@ -14,7 +14,7 @@
 # and the "b" field is the hex byte sequence for GB18030
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
index 2d0e05fb79..4b77ecc694 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
@@ -8,7 +8,7 @@
 # "euc-jis-2004-std.txt" (http://x0213.org)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
index 4073578027..41c825dbe7 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
@@ -12,7 +12,7 @@
 # organization's ftp site.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
index 9112e1cfe9..ff2a644012 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
@@ -17,7 +17,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
index 4ad17064ab..d2a3dac589 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
@@ -18,7 +18,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
index 9c8a983bf7..88c9c374b2 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
@@ -14,7 +14,7 @@
 # and the "b" field is the hex byte sequence for GB18030
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl b/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
index f50baa8f1f..decf8ab443 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
@@ -16,7 +16,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
index ed010a58fa..eb57ca89c5 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
@@ -8,7 +8,7 @@
 # "sjis-0213-2004-std.txt" (http://x0213.org)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
index 0808c6836b..3ef8960ade 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
@@ -11,7 +11,7 @@
 # ftp site.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_UHC.pl b/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
index 207677d76d..cc8b7d804c 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
@@ -14,7 +14,7 @@
 # and the "b" field is the hex byte sequence for UHC
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/UCS_to_most.pl b/src/backend/utils/mb/Unicode/UCS_to_most.pl
index a1947308ff..2a095b7d7d 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_most.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_most.pl
@@ -16,7 +16,7 @@
 #		 # and Unicode name (not used in this script)
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use convutils;
 
diff --git a/src/backend/utils/mb/Unicode/convutils.pm b/src/backend/utils/mb/Unicode/convutils.pm
index 77de7b1a4d..0f55d9621b 100644
--- a/src/backend/utils/mb/Unicode/convutils.pm
+++ b/src/backend/utils/mb/Unicode/convutils.pm
@@ -6,7 +6,7 @@
 package convutils;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Exporter 'import';
diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl
index 45f96cd8bb..cd86ce3122 100644
--- a/src/bin/initdb/t/001_initdb.pl
+++ b/src/bin/initdb/t/001_initdb.pl
@@ -6,7 +6,7 @@
 # Successful initdb consumes much time and I/O.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Fcntl ':mode';
 use File::stat qw{lstat};
 use PostgreSQL::Test::Cluster;
diff --git a/src/bin/pg_amcheck/t/001_basic.pl b/src/bin/pg_amcheck/t/001_basic.pl
index 1f1e33278b..9737d965aa 100644
--- a/src/bin/pg_amcheck/t/001_basic.pl
+++ b/src/bin/pg_amcheck/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_amcheck/t/002_nonesuch.pl b/src/bin/pg_amcheck/t/002_nonesuch.pl
index 99b94dd022..df7ff5397a 100644
--- a/src/bin/pg_amcheck/t/002_nonesuch.pl
+++ b/src/bin/pg_amcheck/t/002_nonesuch.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_amcheck/t/003_check.pl b/src/bin/pg_amcheck/t/003_check.pl
index 2b7ef19855..6d756e70a3 100644
--- a/src/bin/pg_amcheck/t/003_check.pl
+++ b/src/bin/pg_amcheck/t/003_check.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_amcheck/t/004_verify_heapam.pl b/src/bin/pg_amcheck/t/004_verify_heapam.pl
index 1b5027c420..0f57adabe6 100644
--- a/src/bin/pg_amcheck/t/004_verify_heapam.pl
+++ b/src/bin/pg_amcheck/t/004_verify_heapam.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_amcheck/t/005_opclass_damage.pl b/src/bin/pg_amcheck/t/005_opclass_damage.pl
index a5ef2c0f33..e8e1d62d83 100644
--- a/src/bin/pg_amcheck/t/005_opclass_damage.pl
+++ b/src/bin/pg_amcheck/t/005_opclass_damage.pl
@@ -5,7 +5,7 @@
 # presence of breaking sort order changes.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
index 18a82ff002..279c438345 100644
--- a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
+++ b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index b9f5e1266b..c4c197ae1a 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename qw(basename dirname);
 use File::Path     qw(rmtree);
 use PostgreSQL::Test::Cluster;
diff --git a/src/bin/pg_basebackup/t/011_in_place_tablespace.pl b/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
index d58696e8f9..da7154362e 100644
--- a/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
+++ b/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_basebackup/t/020_pg_receivewal.pl b/src/bin/pg_basebackup/t/020_pg_receivewal.pl
index 374f090a8b..765049ee96 100644
--- a/src/bin/pg_basebackup/t/020_pg_receivewal.pl
+++ b/src/bin/pg_basebackup/t/020_pg_receivewal.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
index 62dca5b67a..1bbe88da14 100644
--- a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
+++ b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/pg_checksums/t/001_basic.pl b/src/bin/pg_checksums/t/001_basic.pl
index d3601a5dd8..cfc147b77c 100644
--- a/src/bin/pg_checksums/t/001_basic.pl
+++ b/src/bin/pg_checksums/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.pl
index 2d63182d59..207dc8ec9c 100644
--- a/src/bin/pg_checksums/t/002_actions.pl
+++ b/src/bin/pg_checksums/t/002_actions.pl
@@ -5,7 +5,7 @@
 # an initialized cluster.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 
diff --git a/src/bin/pg_config/t/001_pg_config.pl b/src/bin/pg_config/t/001_pg_config.pl
index 24acf7872b..693f7be054 100644
--- a/src/bin/pg_config/t/001_pg_config.pl
+++ b/src/bin/pg_config/t/001_pg_config.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_controldata/t/001_pg_controldata.pl b/src/bin/pg_controldata/t/001_pg_controldata.pl
index 9db8015d0b..6c7deda617 100644
--- a/src/bin/pg_controldata/t/001_pg_controldata.pl
+++ b/src/bin/pg_controldata/t/001_pg_controldata.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index f019fe1703..e072916dfa 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_ctl/t/002_status.pl b/src/bin/pg_ctl/t/002_status.pl
index f5c50f6a7d..95bba696a4 100644
--- a/src/bin/pg_ctl/t/002_status.pl
+++ b/src/bin/pg_ctl/t/002_status.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_ctl/t/003_promote.pl b/src/bin/pg_ctl/t/003_promote.pl
index 0e83933098..f38e02f4a2 100644
--- a/src/bin/pg_ctl/t/003_promote.pl
+++ b/src/bin/pg_ctl/t/003_promote.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_ctl/t/004_logrotate.pl b/src/bin/pg_ctl/t/004_logrotate.pl
index 8d48e56ee9..912d89b5d6 100644
--- a/src/bin/pg_ctl/t/004_logrotate.pl
+++ b/src/bin/pg_ctl/t/004_logrotate.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/001_basic.pl b/src/bin/pg_dump/t/001_basic.pl
index 8c63d31cb6..60f0e1de45 100644
--- a/src/bin/pg_dump/t/001_basic.pl
+++ b/src/bin/pg_dump/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index eb3ec534b4..223a3a8e87 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/003_pg_dump_with_server.pl b/src/bin/pg_dump/t/003_pg_dump_with_server.pl
index ab025c44a4..e21de45ba2 100644
--- a/src/bin/pg_dump/t/003_pg_dump_with_server.pl
+++ b/src/bin/pg_dump/t/003_pg_dump_with_server.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/004_pg_dump_parallel.pl b/src/bin/pg_dump/t/004_pg_dump_parallel.pl
index c4b461ed87..c14391f58b 100644
--- a/src/bin/pg_dump/t/004_pg_dump_parallel.pl
+++ b/src/bin/pg_dump/t/004_pg_dump_parallel.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/005_pg_dump_filterfile.pl b/src/bin/pg_dump/t/005_pg_dump_filterfile.pl
index d16f034170..308a1e42c4 100644
--- a/src/bin/pg_dump/t/005_pg_dump_filterfile.pl
+++ b/src/bin/pg_dump/t/005_pg_dump_filterfile.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_dump/t/010_dump_connstr.pl b/src/bin/pg_dump/t/010_dump_connstr.pl
index ed86c332ef..f03e1e08cc 100644
--- a/src/bin/pg_dump/t/010_dump_connstr.pl
+++ b/src/bin/pg_dump/t/010_dump_connstr.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_resetwal/t/001_basic.pl b/src/bin/pg_resetwal/t/001_basic.pl
index 18d0882cb1..dcb5fa846e 100644
--- a/src/bin/pg_resetwal/t/001_basic.pl
+++ b/src/bin/pg_resetwal/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_resetwal/t/002_corrupted.pl b/src/bin/pg_resetwal/t/002_corrupted.pl
index 91e4757ebc..61c2339e24 100644
--- a/src/bin/pg_resetwal/t/002_corrupted.pl
+++ b/src/bin/pg_resetwal/t/002_corrupted.pl
@@ -4,7 +4,7 @@
 # Tests for handling a corrupted pg_control
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_rewind/t/001_basic.pl b/src/bin/pg_rewind/t/001_basic.pl
index c7b48255a7..842f6c7fbe 100644
--- a/src/bin/pg_rewind/t/001_basic.pl
+++ b/src/bin/pg_rewind/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/002_databases.pl b/src/bin/pg_rewind/t/002_databases.pl
index 0d480aedb4..313b2486e1 100644
--- a/src/bin/pg_rewind/t/002_databases.pl
+++ b/src/bin/pg_rewind/t/002_databases.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/003_extrafiles.pl b/src/bin/pg_rewind/t/003_extrafiles.pl
index fd2bee5d20..6e040239c4 100644
--- a/src/bin/pg_rewind/t/003_extrafiles.pl
+++ b/src/bin/pg_rewind/t/003_extrafiles.pl
@@ -4,7 +4,7 @@
 # Test how pg_rewind reacts to extra files and directories in the data dirs.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index 5fb7fa9077..7d1bb65cae 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -5,7 +5,7 @@
 # Test pg_rewind when the target's pg_wal directory is a symlink.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Copy;
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_rewind/t/005_same_timeline.pl b/src/bin/pg_rewind/t/005_same_timeline.pl
index b4ef05e560..57e04b0ce2 100644
--- a/src/bin/pg_rewind/t/005_same_timeline.pl
+++ b/src/bin/pg_rewind/t/005_same_timeline.pl
@@ -6,7 +6,7 @@
 # on the same timeline runs successfully.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/006_options.pl b/src/bin/pg_rewind/t/006_options.pl
index 4b6e39a47c..c346b370a6 100644
--- a/src/bin/pg_rewind/t/006_options.pl
+++ b/src/bin/pg_rewind/t/006_options.pl
@@ -5,7 +5,7 @@
 # Test checking options of pg_rewind.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/007_standby_source.pl b/src/bin/pg_rewind/t/007_standby_source.pl
index 4fd1ed001c..fab84a4bbb 100644
--- a/src/bin/pg_rewind/t/007_standby_source.pl
+++ b/src/bin/pg_rewind/t/007_standby_source.pl
@@ -25,7 +25,7 @@
 # as is.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/008_min_recovery_point.pl b/src/bin/pg_rewind/t/008_min_recovery_point.pl
index d4c89451e6..287e4555b5 100644
--- a/src/bin/pg_rewind/t/008_min_recovery_point.pl
+++ b/src/bin/pg_rewind/t/008_min_recovery_point.pl
@@ -31,7 +31,7 @@
 # nodes.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_rewind/t/009_growing_files.pl b/src/bin/pg_rewind/t/009_growing_files.pl
index cf60a04ae7..016f7736e7 100644
--- a/src/bin/pg_rewind/t/009_growing_files.pl
+++ b/src/bin/pg_rewind/t/009_growing_files.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm
index 8fbbd521cb..23144f19e8 100644
--- a/src/bin/pg_rewind/t/RewindTest.pm
+++ b/src/bin/pg_rewind/t/RewindTest.pm
@@ -32,7 +32,7 @@ package RewindTest;
 # to run psql against the primary and standby servers, respectively.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Exporter 'import';
diff --git a/src/bin/pg_test_fsync/t/001_basic.pl b/src/bin/pg_test_fsync/t/001_basic.pl
index 401ad2c07c..135e68b9ba 100644
--- a/src/bin/pg_test_fsync/t/001_basic.pl
+++ b/src/bin/pg_test_fsync/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_test_timing/t/001_basic.pl b/src/bin/pg_test_timing/t/001_basic.pl
index 43bc68cb37..628a603f85 100644
--- a/src/bin/pg_test_timing/t/001_basic.pl
+++ b/src/bin/pg_test_timing/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_upgrade/t/001_basic.pl b/src/bin/pg_upgrade/t/001_basic.pl
index ceac4e0851..6f7117cec6 100644
--- a/src/bin/pg_upgrade/t/001_basic.pl
+++ b/src/bin/pg_upgrade/t/001_basic.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index e5f57e550a..b0470844de 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -2,7 +2,7 @@
 
 # Set of tests for pg_upgrade, including cross-version checks.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd            qw(abs_path);
 use File::Basename qw(dirname);
diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl
index 020e7aa1cc..752c25a601 100644
--- a/src/bin/pg_upgrade/t/003_logical_slots.pl
+++ b/src/bin/pg_upgrade/t/003_logical_slots.pl
@@ -3,7 +3,7 @@
 # Tests for upgrading logical replication slots
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Find qw(find);
 
diff --git a/src/bin/pg_verifybackup/t/001_basic.pl b/src/bin/pg_verifybackup/t/001_basic.pl
index 73e8663238..f1127c827a 100644
--- a/src/bin/pg_verifybackup/t/001_basic.pl
+++ b/src/bin/pg_verifybackup/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use Test::More;
 
diff --git a/src/bin/pg_verifybackup/t/002_algorithm.pl b/src/bin/pg_verifybackup/t/002_algorithm.pl
index 5b02ea4d55..c9f0c10f83 100644
--- a/src/bin/pg_verifybackup/t/002_algorithm.pl
+++ b/src/bin/pg_verifybackup/t/002_algorithm.pl
@@ -4,7 +4,7 @@
 # Verify that we can take and verify backups with various checksum types.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/003_corruption.pl b/src/bin/pg_verifybackup/t/003_corruption.pl
index 4cc3dd05e3..273a6ff77b 100644
--- a/src/bin/pg_verifybackup/t/003_corruption.pl
+++ b/src/bin/pg_verifybackup/t/003_corruption.pl
@@ -4,7 +4,7 @@
 # Verify that various forms of corruption are detected by pg_verifybackup.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/004_options.pl b/src/bin/pg_verifybackup/t/004_options.pl
index 2aa8352f00..f6b092b58a 100644
--- a/src/bin/pg_verifybackup/t/004_options.pl
+++ b/src/bin/pg_verifybackup/t/004_options.pl
@@ -4,7 +4,7 @@
 # Verify the behavior of assorted pg_verifybackup options.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/005_bad_manifest.pl b/src/bin/pg_verifybackup/t/005_bad_manifest.pl
index c94fdd5df8..d481ea1f02 100644
--- a/src/bin/pg_verifybackup/t/005_bad_manifest.pl
+++ b/src/bin/pg_verifybackup/t/005_bad_manifest.pl
@@ -5,7 +5,7 @@
 # problems.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_verifybackup/t/006_encoding.pl b/src/bin/pg_verifybackup/t/006_encoding.pl
index 0b37bda20c..3831a28272 100644
--- a/src/bin/pg_verifybackup/t/006_encoding.pl
+++ b/src/bin/pg_verifybackup/t/006_encoding.pl
@@ -4,7 +4,7 @@
 # Verify that pg_verifybackup handles hex-encoded filenames correctly.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_verifybackup/t/007_wal.pl b/src/bin/pg_verifybackup/t/007_wal.pl
index 89f96f85db..ea3d60b242 100644
--- a/src/bin/pg_verifybackup/t/007_wal.pl
+++ b/src/bin/pg_verifybackup/t/007_wal.pl
@@ -4,7 +4,7 @@
 # Test pg_verifybackup's WAL verification.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_verifybackup/t/008_untar.pl b/src/bin/pg_verifybackup/t/008_untar.pl
index 1a783d1188..7f0f2245f6 100644
--- a/src/bin/pg_verifybackup/t/008_untar.pl
+++ b/src/bin/pg_verifybackup/t/008_untar.pl
@@ -6,7 +6,7 @@
 # format.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/009_extract.pl b/src/bin/pg_verifybackup/t/009_extract.pl
index f4d5378555..e8e4f60768 100644
--- a/src/bin/pg_verifybackup/t/009_extract.pl
+++ b/src/bin/pg_verifybackup/t/009_extract.pl
@@ -5,7 +5,7 @@
 # a backup which was compressed by the server.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_verifybackup/t/010_client_untar.pl b/src/bin/pg_verifybackup/t/010_client_untar.pl
index 44d83e777f..64907f0cae 100644
--- a/src/bin/pg_verifybackup/t/010_client_untar.pl
+++ b/src/bin/pg_verifybackup/t/010_client_untar.pl
@@ -5,7 +5,7 @@
 # backup that didn't start out in plain format.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Path qw(rmtree);
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pg_waldump/t/001_basic.pl b/src/bin/pg_waldump/t/001_basic.pl
index 029a0d0521..b805283385 100644
--- a/src/bin/pg_waldump/t/001_basic.pl
+++ b/src/bin/pg_waldump/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/pg_waldump/t/002_save_fullpage.pl b/src/bin/pg_waldump/t/002_save_fullpage.pl
index f0725805f2..ed6726c486 100644
--- a/src/bin/pg_waldump/t/002_save_fullpage.pl
+++ b/src/bin/pg_waldump/t/002_save_fullpage.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename;
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::RecursiveCopy;
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl
index 85e6520007..3e719cdeca 100644
--- a/src/bin/pgbench/t/001_pgbench_with_server.pl
+++ b/src/bin/pgbench/t/001_pgbench_with_server.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/pgbench/t/002_pgbench_no_server.pl b/src/bin/pgbench/t/002_pgbench_no_server.pl
index ffc8c772ae..457c67555f 100644
--- a/src/bin/pgbench/t/002_pgbench_no_server.pl
+++ b/src/bin/pgbench/t/002_pgbench_no_server.pl
@@ -6,7 +6,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/bin/psql/create_help.pl b/src/bin/psql/create_help.pl
index 0809db4151..def02465d5 100644
--- a/src/bin/psql/create_help.pl
+++ b/src/bin/psql/create_help.pl
@@ -20,7 +20,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $docdir = '';
diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl
index 95f4e60ab2..eefcdfa05f 100644
--- a/src/bin/psql/t/001_basic.pl
+++ b/src/bin/psql/t/001_basic.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use locale;
 
 use PostgreSQL::Test::Cluster;
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl
index 4cd0fa4680..44fdd056fa 100644
--- a/src/bin/psql/t/010_tab_completion.pl
+++ b/src/bin/psql/t/010_tab_completion.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/psql/t/020_cancel.pl b/src/bin/psql/t/020_cancel.pl
index 2590b014dd..5f0b921ac3 100644
--- a/src/bin/psql/t/020_cancel.pl
+++ b/src/bin/psql/t/020_cancel.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/010_clusterdb.pl b/src/bin/scripts/t/010_clusterdb.pl
index 715207fb4d..60792c2eea 100644
--- a/src/bin/scripts/t/010_clusterdb.pl
+++ b/src/bin/scripts/t/010_clusterdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/011_clusterdb_all.pl b/src/bin/scripts/t/011_clusterdb_all.pl
index 35f0b18f50..26315d0a51 100644
--- a/src/bin/scripts/t/011_clusterdb_all.pl
+++ b/src/bin/scripts/t/011_clusterdb_all.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl
index 40291924e5..8815477672 100644
--- a/src/bin/scripts/t/020_createdb.pl
+++ b/src/bin/scripts/t/020_createdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/040_createuser.pl b/src/bin/scripts/t/040_createuser.pl
index 3290e30c88..75dd7331ba 100644
--- a/src/bin/scripts/t/040_createuser.pl
+++ b/src/bin/scripts/t/040_createuser.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/050_dropdb.pl b/src/bin/scripts/t/050_dropdb.pl
index 3ed670bb0a..e5acab9a38 100644
--- a/src/bin/scripts/t/050_dropdb.pl
+++ b/src/bin/scripts/t/050_dropdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/070_dropuser.pl b/src/bin/scripts/t/070_dropuser.pl
index 95c24c4f30..74947e8ca7 100644
--- a/src/bin/scripts/t/070_dropuser.pl
+++ b/src/bin/scripts/t/070_dropuser.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/080_pg_isready.pl b/src/bin/scripts/t/080_pg_isready.pl
index 8f53aef573..9784006465 100644
--- a/src/bin/scripts/t/080_pg_isready.pl
+++ b/src/bin/scripts/t/080_pg_isready.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl
index b663d0e741..7ed71849c3 100644
--- a/src/bin/scripts/t/090_reindexdb.pl
+++ b/src/bin/scripts/t/090_reindexdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/091_reindexdb_all.pl b/src/bin/scripts/t/091_reindexdb_all.pl
index 7f3e081ceb..fdb198b4e7 100644
--- a/src/bin/scripts/t/091_reindexdb_all.pl
+++ b/src/bin/scripts/t/091_reindexdb_all.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl
index 925079bbed..f731457e2e 100644
--- a/src/bin/scripts/t/100_vacuumdb.pl
+++ b/src/bin/scripts/t/100_vacuumdb.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/bin/scripts/t/101_vacuumdb_all.pl b/src/bin/scripts/t/101_vacuumdb_all.pl
index 8d7c3ab014..673a94d005 100644
--- a/src/bin/scripts/t/101_vacuumdb_all.pl
+++ b/src/bin/scripts/t/101_vacuumdb_all.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/scripts/t/102_vacuumdb_stages.pl b/src/bin/scripts/t/102_vacuumdb_stages.pl
index 64d7ed1575..c1174fd5e8 100644
--- a/src/bin/scripts/t/102_vacuumdb_stages.pl
+++ b/src/bin/scripts/t/102_vacuumdb_stages.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/bin/scripts/t/200_connstr.pl b/src/bin/scripts/t/200_connstr.pl
index 53c5e21ab2..4f3d9ffe98 100644
--- a/src/bin/scripts/t/200_connstr.pl
+++ b/src/bin/scripts/t/200_connstr.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/common/unicode/generate-norm_test_table.pl b/src/common/unicode/generate-norm_test_table.pl
index 3434f7e263..fb1718047f 100644
--- a/src/common/unicode/generate-norm_test_table.pl
+++ b/src/common/unicode/generate-norm_test_table.pl
@@ -8,7 +8,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Basename;
 
diff --git a/src/common/unicode/generate-unicode_category_table.pl b/src/common/unicode/generate-unicode_category_table.pl
index 992b877ede..7936eed102 100644
--- a/src/common/unicode/generate-unicode_category_table.pl
+++ b/src/common/unicode/generate-unicode_category_table.pl
@@ -9,7 +9,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/common/unicode/generate-unicode_east_asian_fw_table.pl b/src/common/unicode/generate-unicode_east_asian_fw_table.pl
index 125bd396a0..91423be78e 100644
--- a/src/common/unicode/generate-unicode_east_asian_fw_table.pl
+++ b/src/common/unicode/generate-unicode_east_asian_fw_table.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2019-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $range_start = undef;
 my ($first, $last);
diff --git a/src/common/unicode/generate-unicode_nonspacing_table.pl b/src/common/unicode/generate-unicode_nonspacing_table.pl
index ae86e82922..521b939943 100644
--- a/src/common/unicode/generate-unicode_nonspacing_table.pl
+++ b/src/common/unicode/generate-unicode_nonspacing_table.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2019-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $range_start = undef;
 my $codepoint;
diff --git a/src/common/unicode/generate-unicode_norm_table.pl b/src/common/unicode/generate-unicode_norm_table.pl
index d5914118ab..65b001d065 100644
--- a/src/common/unicode/generate-unicode_norm_table.pl
+++ b/src/common/unicode/generate-unicode_norm_table.pl
@@ -9,7 +9,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/common/unicode/generate-unicode_normprops_table.pl b/src/common/unicode/generate-unicode_normprops_table.pl
index 1b7473180b..f831c2d0d5 100644
--- a/src/common/unicode/generate-unicode_normprops_table.pl
+++ b/src/common/unicode/generate-unicode_normprops_table.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2020-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib "$FindBin::RealBin/../../tools/";
diff --git a/src/common/unicode/generate-unicode_version.pl b/src/common/unicode/generate-unicode_version.pl
index 22eb2f1a3d..e8cdb8e7d1 100644
--- a/src/common/unicode/generate-unicode_version.pl
+++ b/src/common/unicode/generate-unicode_version.pl
@@ -7,7 +7,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/include/catalog/duplicate_oids b/src/include/catalog/duplicate_oids
index eb5c3fb084..1830b95b0a 100755
--- a/src/include/catalog/duplicate_oids
+++ b/src/include/catalog/duplicate_oids
@@ -17,7 +17,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Must run in src/include/catalog
 use FindBin;
diff --git a/src/include/catalog/reformat_dat_file.pl b/src/include/catalog/reformat_dat_file.pl
index 725117d846..b5235c24d3 100755
--- a/src/include/catalog/reformat_dat_file.pl
+++ b/src/include/catalog/reformat_dat_file.pl
@@ -18,7 +18,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use Getopt::Long;
diff --git a/src/include/catalog/renumber_oids.pl b/src/include/catalog/renumber_oids.pl
index ec09584959..a418b33d58 100755
--- a/src/include/catalog/renumber_oids.pl
+++ b/src/include/catalog/renumber_oids.pl
@@ -16,7 +16,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use Getopt::Long;
diff --git a/src/include/catalog/unused_oids b/src/include/catalog/unused_oids
index ccf3c3f781..f5f0c57b74 100755
--- a/src/include/catalog/unused_oids
+++ b/src/include/catalog/unused_oids
@@ -19,7 +19,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Must run in src/include/catalog
 use FindBin;
diff --git a/src/interfaces/ecpg/preproc/check_rules.pl b/src/interfaces/ecpg/preproc/check_rules.pl
index 5e823fa30e..6417ee7315 100644
--- a/src/interfaces/ecpg/preproc/check_rules.pl
+++ b/src/interfaces/ecpg/preproc/check_rules.pl
@@ -17,7 +17,7 @@
 # Then it checks to make sure each rule in ecpg.addons was found in gram.y
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $srcdir = '.';
diff --git a/src/interfaces/ecpg/preproc/parse.pl b/src/interfaces/ecpg/preproc/parse.pl
index 7574fc3110..b0caeb356f 100644
--- a/src/interfaces/ecpg/preproc/parse.pl
+++ b/src/interfaces/ecpg/preproc/parse.pl
@@ -13,7 +13,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $srcdir = '.';
diff --git a/src/interfaces/libpq/t/001_uri.pl b/src/interfaces/libpq/t/001_uri.pl
index fd062a95c5..cd876e758f 100644
--- a/src/interfaces/libpq/t/001_uri.pl
+++ b/src/interfaces/libpq/t/001_uri.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/interfaces/libpq/t/002_api.pl b/src/interfaces/libpq/t/002_api.pl
index 8b43a984fb..9d376bcaa2 100644
--- a/src/interfaces/libpq/t/002_api.pl
+++ b/src/interfaces/libpq/t/002_api.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/interfaces/libpq/t/003_load_balance_host_list.pl b/src/interfaces/libpq/t/003_load_balance_host_list.pl
index 21c3b8dd33..c6fe049fe5 100644
--- a/src/interfaces/libpq/t/003_load_balance_host_list.pl
+++ b/src/interfaces/libpq/t/003_load_balance_host_list.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config;
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
diff --git a/src/interfaces/libpq/t/004_load_balance_dns.pl b/src/interfaces/libpq/t/004_load_balance_dns.pl
index 875070e212..81cf628ac7 100644
--- a/src/interfaces/libpq/t/004_load_balance_dns.pl
+++ b/src/interfaces/libpq/t/004_load_balance_dns.pl
@@ -1,6 +1,6 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config;
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
diff --git a/src/pl/plperl/plc_perlboot.pl b/src/pl/plperl/plc_perlboot.pl
index 13298013d3..90c1b7e667 100644
--- a/src/pl/plperl/plc_perlboot.pl
+++ b/src/pl/plperl/plc_perlboot.pl
@@ -4,7 +4,7 @@
 #  src/pl/plperl/plc_perlboot.pl
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use vars qw(%_SHARED $_TD);
 
@@ -58,7 +58,7 @@ sub ::encode_array_constructor
 	package PostgreSQL::InServer;  ## no critic (RequireFilenameMatchesPackage)
 #>>>
 	use strict;
-	use warnings;
+	use warnings FATAL => 'all';
 
 	sub plperl_warn
 	{
@@ -107,7 +107,7 @@ sub ::encode_array_constructor
 
 	package PostgreSQL::InServer::ARRAY;
 	use strict;
-	use warnings;
+	use warnings FATAL => 'all';
 
 	use overload
 	  '""' => \&to_str,
diff --git a/src/pl/plperl/plperl_opmask.pl b/src/pl/plperl/plperl_opmask.pl
index 26ac717770..09dc72d273 100644
--- a/src/pl/plperl/plperl_opmask.pl
+++ b/src/pl/plperl/plperl_opmask.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Opcode qw(opset opset_to_ops opdesc);
 
diff --git a/src/pl/plperl/text2macro.pl b/src/pl/plperl/text2macro.pl
index 933632c0df..7a41da84c6 100644
--- a/src/pl/plperl/text2macro.pl
+++ b/src/pl/plperl/text2macro.pl
@@ -27,7 +27,7 @@ =head1 DESCRIPTION
 =cut
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Getopt::Long;
 
diff --git a/src/pl/plpgsql/src/generate-plerrcodes.pl b/src/pl/plpgsql/src/generate-plerrcodes.pl
index f4fd376ef9..03ce58b94e 100644
--- a/src/pl/plpgsql/src/generate-plerrcodes.pl
+++ b/src/pl/plpgsql/src/generate-plerrcodes.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
diff --git a/src/pl/plpython/generate-spiexceptions.pl b/src/pl/plpython/generate-spiexceptions.pl
index 61b37c3541..090e20472c 100644
--- a/src/pl/plpython/generate-spiexceptions.pl
+++ b/src/pl/plpython/generate-spiexceptions.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
diff --git a/src/pl/tcl/generate-pltclerrcodes.pl b/src/pl/tcl/generate-pltclerrcodes.pl
index 9c2309108c..df1ba7d4d4 100644
--- a/src/pl/tcl/generate-pltclerrcodes.pl
+++ b/src/pl/tcl/generate-pltclerrcodes.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2000-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 print
   "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
diff --git a/src/test/authentication/t/001_password.pl b/src/test/authentication/t/001_password.pl
index 320e45ef84..6a2b2ae790 100644
--- a/src/test/authentication/t/001_password.pl
+++ b/src/test/authentication/t/001_password.pl
@@ -9,7 +9,7 @@
 # This test can only run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/002_saslprep.pl b/src/test/authentication/t/002_saslprep.pl
index ef15831166..c3a73dfda1 100644
--- a/src/test/authentication/t/002_saslprep.pl
+++ b/src/test/authentication/t/002_saslprep.pl
@@ -6,7 +6,7 @@
 # This test can only run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/003_peer.pl b/src/test/authentication/t/003_peer.pl
index eacff2b52a..96217b6661 100644
--- a/src/test/authentication/t/003_peer.pl
+++ b/src/test/authentication/t/003_peer.pl
@@ -6,7 +6,7 @@
 # and is only able to run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/004_file_inclusion.pl b/src/test/authentication/t/004_file_inclusion.pl
index 55d28ad586..364bba81ca 100644
--- a/src/test/authentication/t/004_file_inclusion.pl
+++ b/src/test/authentication/t/004_file_inclusion.pl
@@ -5,7 +5,7 @@
 # only run with Unix-domain sockets.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use File::Basename qw(basename);
diff --git a/src/test/authentication/t/005_sspi.pl b/src/test/authentication/t/005_sspi.pl
index 37fd5bc243..bdc829dcf8 100644
--- a/src/test/authentication/t/005_sspi.pl
+++ b/src/test/authentication/t/005_sspi.pl
@@ -4,7 +4,7 @@
 # Tests targeting SSPI on Windows.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/authentication/t/006_login_trigger.pl b/src/test/authentication/t/006_login_trigger.pl
index 3f1a8a7c45..3415ab9e00 100644
--- a/src/test/authentication/t/006_login_trigger.pl
+++ b/src/test/authentication/t/006_login_trigger.pl
@@ -5,7 +5,7 @@
 # tests.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/icu/t/010_database.pl b/src/test/icu/t/010_database.pl
index 67fc3bbf19..39cba8492d 100644
--- a/src/test/icu/t/010_database.pl
+++ b/src/test/icu/t/010_database.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index 0deb9bffc8..e9ceb712f5 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -18,7 +18,7 @@
 # See the README for additional information.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
diff --git a/src/test/ldap/LdapServer.pm b/src/test/ldap/LdapServer.pm
index a4c1a1843c..f63844d60a 100644
--- a/src/test/ldap/LdapServer.pm
+++ b/src/test/ldap/LdapServer.pm
@@ -46,7 +46,7 @@ LdapServer - class for an LDAP server for testing pg_hba.conf authentication
 package LdapServer;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 3e113fd6eb..5e569c4db9 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib "$FindBin::RealBin/..";
diff --git a/src/test/ldap/t/002_bindpasswd.pl b/src/test/ldap/t/002_bindpasswd.pl
index bcd4aa2b74..204ed39059 100644
--- a/src/test/ldap/t/002_bindpasswd.pl
+++ b/src/test/ldap/t/002_bindpasswd.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use lib "$FindBin::RealBin/..";
diff --git a/src/test/locale/sort-test.pl b/src/test/locale/sort-test.pl
index 8bed29b3ad..47efa8f8bb 100755
--- a/src/test/locale/sort-test.pl
+++ b/src/test/locale/sort-test.pl
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use locale;
 
 open(my $in_fh, '<', $ARGV[0]) || die;
diff --git a/src/test/modules/brin/t/01_workitems.pl b/src/test/modules/brin/t/01_workitems.pl
index 5f71074231..376c3a43f1 100644
--- a/src/test/modules/brin/t/01_workitems.pl
+++ b/src/test/modules/brin/t/01_workitems.pl
@@ -4,7 +4,7 @@
 # Verify that work items work correctly
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/brin/t/02_wal_consistency.pl b/src/test/modules/brin/t/02_wal_consistency.pl
index 8b2b244feb..a588a28669 100644
--- a/src/test/modules/brin/t/02_wal_consistency.pl
+++ b/src/test/modules/brin/t/02_wal_consistency.pl
@@ -3,7 +3,7 @@
 # Verify WAL consistency
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/001_base.pl b/src/test/modules/commit_ts/t/001_base.pl
index ae3fc5f52d..d6ea0c4c69 100644
--- a/src/test/modules/commit_ts/t/001_base.pl
+++ b/src/test/modules/commit_ts/t/001_base.pl
@@ -4,7 +4,7 @@
 # Single-node test: value can be set, and is still present after recovery
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/002_standby.pl b/src/test/modules/commit_ts/t/002_standby.pl
index 59cc2b1244..e843578ddb 100644
--- a/src/test/modules/commit_ts/t/002_standby.pl
+++ b/src/test/modules/commit_ts/t/002_standby.pl
@@ -4,7 +4,7 @@
 # Test simple scenario involving a standby
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl
index 5af511e369..b38c3c0f26 100644
--- a/src/test/modules/commit_ts/t/003_standby_2.pl
+++ b/src/test/modules/commit_ts/t/003_standby_2.pl
@@ -4,7 +4,7 @@
 # Test primary/standby scenario where the track_commit_timestamp GUC is
 # repeatedly toggled on and off.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/commit_ts/t/004_restart.pl b/src/test/modules/commit_ts/t/004_restart.pl
index 8fe4bedb14..399268ebee 100644
--- a/src/test/modules/commit_ts/t/004_restart.pl
+++ b/src/test/modules/commit_ts/t/004_restart.pl
@@ -3,7 +3,7 @@
 
 # Testing of commit timestamps preservation across restarts
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl b/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
index c96c8d7a4d..b7ac65091a 100644
--- a/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
+++ b/src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2022, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Copy;
 use FindBin;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
index 056fa5c6d2..71a11ddf25 100644
--- a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
+++ b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
index 2b2c144ee2..c63e7bd394 100644
--- a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
+++ b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Copy;
 
diff --git a/src/test/modules/test_custom_rmgrs/t/001_basic.pl b/src/test/modules/test_custom_rmgrs/t/001_basic.pl
index 50655d3788..dc3d830299 100644
--- a/src/test/modules/test_custom_rmgrs/t/001_basic.pl
+++ b/src/test/modules/test_custom_rmgrs/t/001_basic.pl
@@ -1,7 +1,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/test_misc/t/001_constraint_validation.pl b/src/test/modules/test_misc/t/001_constraint_validation.pl
index 5a07a5d36d..4d0ea0c59d 100644
--- a/src/test/modules/test_misc/t/001_constraint_validation.pl
+++ b/src/test/modules/test_misc/t/001_constraint_validation.pl
@@ -4,7 +4,7 @@
 # Verify that ALTER TABLE optimizes certain operations as expected
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/test_misc/t/002_tablespace.pl b/src/test/modules/test_misc/t/002_tablespace.pl
index f774a021a8..220e2b073d 100644
--- a/src/test/modules/test_misc/t/002_tablespace.pl
+++ b/src/test/modules/test_misc/t/002_tablespace.pl
@@ -3,7 +3,7 @@
 # regression tests.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/test_misc/t/003_check_guc.pl b/src/test/modules/test_misc/t/003_check_guc.pl
index a5d680e82e..0c222bada9 100644
--- a/src/test/modules/test_misc/t/003_check_guc.pl
+++ b/src/test/modules/test_misc/t/003_check_guc.pl
@@ -2,7 +2,7 @@
 # postgresql.conf.sample.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/test_misc/t/004_io_direct.pl b/src/test/modules/test_misc/t/004_io_direct.pl
index dddcfb1aa9..e3f0966b8d 100644
--- a/src/test/modules/test_misc/t/004_io_direct.pl
+++ b/src/test/modules/test_misc/t/004_io_direct.pl
@@ -1,7 +1,7 @@
 # Very simple exercise of direct I/O GUC.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Fcntl;
 use IO::File;
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl
index a5d5b9b35d..25a80c8c66 100644
--- a/src/test/modules/test_pg_dump/t/001_base.pl
+++ b/src/test/modules/test_pg_dump/t/001_base.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/modules/worker_spi/t/001_worker_spi.pl b/src/test/modules/worker_spi/t/001_worker_spi.pl
index ba1d281e81..4759b55a60 100644
--- a/src/test/modules/worker_spi/t/001_worker_spi.pl
+++ b/src/test/modules/worker_spi/t/001_worker_spi.pl
@@ -3,7 +3,7 @@
 # Test worker_spi module.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl b/src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl
index 4cf579047e..4121154a53 100644
--- a/src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl
+++ b/src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl
@@ -2,7 +2,7 @@
 
 # Test wraparound emergency autovacuum.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/xid_wraparound/t/002_limits.pl b/src/test/modules/xid_wraparound/t/002_limits.pl
index 6aeea19cdc..7750473bc5 100644
--- a/src/test/modules/xid_wraparound/t/002_limits.pl
+++ b/src/test/modules/xid_wraparound/t/002_limits.pl
@@ -8,7 +8,7 @@
 # been advanced.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/modules/xid_wraparound/t/003_wraparounds.pl b/src/test/modules/xid_wraparound/t/003_wraparounds.pl
index be71b00a17..283d1532c2 100644
--- a/src/test/modules/xid_wraparound/t/003_wraparounds.pl
+++ b/src/test/modules/xid_wraparound/t/003_wraparounds.pl
@@ -4,7 +4,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
index e34dfb9243..1b1078f8c6 100644
--- a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
+++ b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
@@ -30,7 +30,7 @@ compare the results of cross-version upgrade tests.
 package PostgreSQL::Test::AdjustUpgrade;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Exporter 'import';
 use PostgreSQL::Version;
diff --git a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
index bae452ac9c..ec91f735a8 100644
--- a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
+++ b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
@@ -54,7 +54,7 @@ initiated by PostgreSQL::Test::Cluster.
 package PostgreSQL::Test::BackgroundPsql;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Config;
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index a020377761..819be5dd9c 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -97,7 +97,7 @@ The IPC::Run module is required.
 package PostgreSQL::Test::Cluster;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Config;
diff --git a/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm b/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
index 15964e6217..1c79bfabd1 100644
--- a/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
+++ b/src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
@@ -19,7 +19,7 @@ PostgreSQL::Test::RecursiveCopy::copypath($from, $to);
 package PostgreSQL::Test::RecursiveCopy;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use File::Basename;
diff --git a/src/test/perl/PostgreSQL/Test/SimpleTee.pm b/src/test/perl/PostgreSQL/Test/SimpleTee.pm
index 82099bf503..9258b7c4cd 100644
--- a/src/test/perl/PostgreSQL/Test/SimpleTee.pm
+++ b/src/test/perl/PostgreSQL/Test/SimpleTee.pm
@@ -17,7 +17,7 @@
 
 package PostgreSQL::Test::SimpleTee;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Time::HiRes qw(time);
 
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index cd86897580..2b78840629 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -42,7 +42,7 @@ aimed at controlling command execution, logging and test functions.
 package PostgreSQL::Test::Utils;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Carp;
 use Config;
diff --git a/src/test/perl/PostgreSQL/Version.pm b/src/test/perl/PostgreSQL/Version.pm
index 3705c1bdaf..dadc90fecc 100644
--- a/src/test/perl/PostgreSQL/Version.pm
+++ b/src/test/perl/PostgreSQL/Version.pm
@@ -45,7 +45,7 @@ of common version formats and comparison operations.
 package PostgreSQL::Version;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Scalar::Util qw(blessed);
 
diff --git a/src/test/perl/README b/src/test/perl/README
index 8fb44184b9..af037a8091 100644
--- a/src/test/perl/README
+++ b/src/test/perl/README
@@ -58,7 +58,7 @@ order.
 Each test script should begin with:
 
     use strict;
-    use warnings;
+    use warnings FATAL => 'all';
     use PostgreSQL::Test::Cluster;
     use PostgreSQL::Test::Utils;
     use Test::More;
diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl
index 95f9b0d772..08deadb476 100644
--- a/src/test/recovery/t/001_stream_rep.pl
+++ b/src/test/recovery/t/001_stream_rep.pl
@@ -3,7 +3,7 @@
 
 # Minimal test testing streaming replication
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/002_archiving.pl b/src/test/recovery/t/002_archiving.pl
index 48e00f9e29..c4d0a2a81f 100644
--- a/src/test/recovery/t/002_archiving.pl
+++ b/src/test/recovery/t/002_archiving.pl
@@ -3,7 +3,7 @@
 
 # test for archiving with hot standby
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.pl
index e882ce2077..1b63116ceb 100644
--- a/src/test/recovery/t/003_recovery_targets.pl
+++ b/src/test/recovery/t/003_recovery_targets.pl
@@ -3,7 +3,7 @@
 
 # Test for recovery targets: name, timestamp, XID
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/004_timeline_switch.pl b/src/test/recovery/t/004_timeline_switch.pl
index edaef91845..2500201b99 100644
--- a/src/test/recovery/t/004_timeline_switch.pl
+++ b/src/test/recovery/t/004_timeline_switch.pl
@@ -3,7 +3,7 @@
 
 # Test for timeline switch
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/005_replay_delay.pl b/src/test/recovery/t/005_replay_delay.pl
index 8fadca4204..2f7a99e687 100644
--- a/src/test/recovery/t/005_replay_delay.pl
+++ b/src/test/recovery/t/005_replay_delay.pl
@@ -3,7 +3,7 @@
 
 # Checks for recovery_min_apply_delay and recovery pause
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl
index 5c851bf4c1..97e3df04aa 100644
--- a/src/test/recovery/t/006_logical_decoding.pl
+++ b/src/test/recovery/t/006_logical_decoding.pl
@@ -7,7 +7,7 @@
 # is for work that doesn't fit well there, like where server restarts
 # are required.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/007_sync_rep.pl b/src/test/recovery/t/007_sync_rep.pl
index 2026af0702..b25ae1e8ec 100644
--- a/src/test/recovery/t/007_sync_rep.pl
+++ b/src/test/recovery/t/007_sync_rep.pl
@@ -3,7 +3,7 @@
 
 # Minimal test testing synchronous replication sync_state transition
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/008_fsm_truncation.pl b/src/test/recovery/t/008_fsm_truncation.pl
index acac0a0a55..10d1535a93 100644
--- a/src/test/recovery/t/008_fsm_truncation.pl
+++ b/src/test/recovery/t/008_fsm_truncation.pl
@@ -6,7 +6,7 @@
 # FSM changes don't normally need to be WAL-logged, except for truncation.
 # The FSM mustn't return a page that doesn't exist (anymore).
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl
index e1273fd0f1..cde6e2a944 100644
--- a/src/test/recovery/t/009_twophase.pl
+++ b/src/test/recovery/t/009_twophase.pl
@@ -3,7 +3,7 @@
 
 # Tests dedicated to two-phase commit in recovery
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl
index 6fbbeedde3..2359821b28 100644
--- a/src/test/recovery/t/010_logical_decoding_timelines.pl
+++ b/src/test/recovery/t/010_logical_decoding_timelines.pl
@@ -22,7 +22,7 @@
 # on logical slots).
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/012_subtransactions.pl b/src/test/recovery/t/012_subtransactions.pl
index 91ae79dd51..32434d4340 100644
--- a/src/test/recovery/t/012_subtransactions.pl
+++ b/src/test/recovery/t/012_subtransactions.pl
@@ -3,7 +3,7 @@
 
 # Tests dedicated to subtransactions in recovery
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/013_crash_restart.pl b/src/test/recovery/t/013_crash_restart.pl
index ce57792f31..0dfd197df4 100644
--- a/src/test/recovery/t/013_crash_restart.pl
+++ b/src/test/recovery/t/013_crash_restart.pl
@@ -12,7 +12,7 @@
 # backend died), or because it's already restarted.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/014_unlogged_reinit.pl b/src/test/recovery/t/014_unlogged_reinit.pl
index 3591b3309e..bee8b8804f 100644
--- a/src/test/recovery/t/014_unlogged_reinit.pl
+++ b/src/test/recovery/t/014_unlogged_reinit.pl
@@ -7,7 +7,7 @@
 # that is not tested here.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/015_promotion_pages.pl b/src/test/recovery/t/015_promotion_pages.pl
index beeb9dfddf..b49dd4c835 100644
--- a/src/test/recovery/t/015_promotion_pages.pl
+++ b/src/test/recovery/t/015_promotion_pages.pl
@@ -6,7 +6,7 @@
 # invalid page references at replay based on the minimum consistent
 # recovery point defined.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/016_min_consistency.pl b/src/test/recovery/t/016_min_consistency.pl
index 81f7a43c07..cabdd3156e 100644
--- a/src/test/recovery/t/016_min_consistency.pl
+++ b/src/test/recovery/t/016_min_consistency.pl
@@ -8,7 +8,7 @@
 # both checked.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/017_shm.pl b/src/test/recovery/t/017_shm.pl
index 74359e0e38..7935ce63d3 100644
--- a/src/test/recovery/t/017_shm.pl
+++ b/src/test/recovery/t/017_shm.pl
@@ -5,7 +5,7 @@
 # Tests of pg_shmem.h functions
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::stat qw(stat);
 use IPC::Run 'run';
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/recovery/t/018_wal_optimize.pl b/src/test/recovery/t/018_wal_optimize.pl
index 1d613eaede..0752bff174 100644
--- a/src/test/recovery/t/018_wal_optimize.pl
+++ b/src/test/recovery/t/018_wal_optimize.pl
@@ -10,7 +10,7 @@
 # For many years, individual commands made the decision to skip WAL, hence the
 # frequent appearance of COPY in these tests.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/019_replslot_limit.pl b/src/test/recovery/t/019_replslot_limit.pl
index 7d94f15778..ba00c8796f 100644
--- a/src/test/recovery/t/019_replslot_limit.pl
+++ b/src/test/recovery/t/019_replslot_limit.pl
@@ -5,7 +5,7 @@
 # Ensure that max_slot_wal_keep_size limits the number of WAL files to
 # be kept by replication slots.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/recovery/t/020_archive_status.pl b/src/test/recovery/t/020_archive_status.pl
index fa24153d4b..ce51bfb58e 100644
--- a/src/test/recovery/t/020_archive_status.pl
+++ b/src/test/recovery/t/020_archive_status.pl
@@ -5,7 +5,7 @@
 # Tests related to WAL archiving and recovery.
 #
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/021_row_visibility.pl b/src/test/recovery/t/021_row_visibility.pl
index 52a6a3509c..3bdd42c25d 100644
--- a/src/test/recovery/t/021_row_visibility.pl
+++ b/src/test/recovery/t/021_row_visibility.pl
@@ -4,7 +4,7 @@
 # Checks that snapshots on standbys behave in a minimally reasonable
 # way.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/022_crash_temp_files.pl b/src/test/recovery/t/022_crash_temp_files.pl
index 14fd8bfc7f..e702323a8f 100644
--- a/src/test/recovery/t/022_crash_temp_files.pl
+++ b/src/test/recovery/t/022_crash_temp_files.pl
@@ -3,7 +3,7 @@
 
 # Test remove of temporary files after a crash.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/023_pitr_prepared_xact.pl b/src/test/recovery/t/023_pitr_prepared_xact.pl
index a8cdf4efdd..090711ca4b 100644
--- a/src/test/recovery/t/023_pitr_prepared_xact.pl
+++ b/src/test/recovery/t/023_pitr_prepared_xact.pl
@@ -3,7 +3,7 @@
 
 # Test for point-in-time recovery (PITR) with prepared transactions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/024_archive_recovery.pl b/src/test/recovery/t/024_archive_recovery.pl
index d594332b18..e9ab11895f 100644
--- a/src/test/recovery/t/024_archive_recovery.pl
+++ b/src/test/recovery/t/024_archive_recovery.pl
@@ -3,7 +3,7 @@
 
 # Test for archive recovery of WAL generated with wal_level=minimal
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/025_stuck_on_old_timeline.pl b/src/test/recovery/t/025_stuck_on_old_timeline.pl
index 91309030df..65d8864327 100644
--- a/src/test/recovery/t/025_stuck_on_old_timeline.pl
+++ b/src/test/recovery/t/025_stuck_on_old_timeline.pl
@@ -7,7 +7,7 @@
 # archive, so the WAL files all have to be streamed.  Test that the cascading
 # standby can follow the new primary (promoted standby).
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 
diff --git a/src/test/recovery/t/026_overwrite_contrecord.pl b/src/test/recovery/t/026_overwrite_contrecord.pl
index 6807a97f26..09c7e13da9 100644
--- a/src/test/recovery/t/026_overwrite_contrecord.pl
+++ b/src/test/recovery/t/026_overwrite_contrecord.pl
@@ -3,7 +3,7 @@
 # Tests for already-propagated WAL segments ending in incomplete WAL records.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use FindBin;
 use PostgreSQL::Test::Cluster;
diff --git a/src/test/recovery/t/027_stream_regress.pl b/src/test/recovery/t/027_stream_regress.pl
index f2f4e77626..20508307b5 100644
--- a/src/test/recovery/t/027_stream_regress.pl
+++ b/src/test/recovery/t/027_stream_regress.pl
@@ -1,6 +1,6 @@
 # Run the standard regression tests with streaming replication
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/028_pitr_timelines.pl b/src/test/recovery/t/028_pitr_timelines.pl
index bb29a2d378..58390b6d79 100644
--- a/src/test/recovery/t/028_pitr_timelines.pl
+++ b/src/test/recovery/t/028_pitr_timelines.pl
@@ -27,7 +27,7 @@
 # The actual checks are not sensitive to that.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/029_stats_restart.pl b/src/test/recovery/t/029_stats_restart.pl
index f6368ab1d3..e350a5e8aa 100644
--- a/src/test/recovery/t/029_stats_restart.pl
+++ b/src/test/recovery/t/029_stats_restart.pl
@@ -4,7 +4,7 @@
 # invalid stats files, as well as restorting stats after "normal" restarts.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/030_stats_cleanup_replica.pl b/src/test/recovery/t/030_stats_cleanup_replica.pl
index 51495aebcd..db451d9d1b 100644
--- a/src/test/recovery/t/030_stats_cleanup_replica.pl
+++ b/src/test/recovery/t/030_stats_cleanup_replica.pl
@@ -6,7 +6,7 @@
 # - discard stats after immediate / crash restarts
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/031_recovery_conflict.pl b/src/test/recovery/t/031_recovery_conflict.pl
index 7cafe2fd86..82ba7a7b10 100644
--- a/src/test/recovery/t/031_recovery_conflict.pl
+++ b/src/test/recovery/t/031_recovery_conflict.pl
@@ -5,7 +5,7 @@
 # pg_stat_database_conflicts are populated correctly
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/032_relfilenode_reuse.pl b/src/test/recovery/t/032_relfilenode_reuse.pl
index 3bc2db1a4f..8a4cceacc2 100644
--- a/src/test/recovery/t/032_relfilenode_reuse.pl
+++ b/src/test/recovery/t/032_relfilenode_reuse.pl
@@ -1,5 +1,5 @@
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/033_replay_tsp_drops.pl b/src/test/recovery/t/033_replay_tsp_drops.pl
index af97ed9f70..64c370224c 100644
--- a/src/test/recovery/t/033_replay_tsp_drops.pl
+++ b/src/test/recovery/t/033_replay_tsp_drops.pl
@@ -4,7 +4,7 @@
 # Test replay of tablespace/database creation/drop
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/034_create_database.pl b/src/test/recovery/t/034_create_database.pl
index ed562bba25..d4d7500dd5 100644
--- a/src/test/recovery/t/034_create_database.pl
+++ b/src/test/recovery/t/034_create_database.pl
@@ -4,7 +4,7 @@
 # Test WAL replay for CREATE DATABASE .. STRATEGY WAL_LOG.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/035_standby_logical_decoding.pl b/src/test/recovery/t/035_standby_logical_decoding.pl
index 9c34c0d36c..5590c0f680 100644
--- a/src/test/recovery/t/035_standby_logical_decoding.pl
+++ b/src/test/recovery/t/035_standby_logical_decoding.pl
@@ -4,7 +4,7 @@
 # recovery conflict and standby promotion.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/036_truncated_dropped.pl b/src/test/recovery/t/036_truncated_dropped.pl
index 2d5339d9d8..53194978fc 100644
--- a/src/test/recovery/t/036_truncated_dropped.pl
+++ b/src/test/recovery/t/036_truncated_dropped.pl
@@ -5,7 +5,7 @@
 # truncated or dropped.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/recovery/t/037_invalid_database.pl b/src/test/recovery/t/037_invalid_database.pl
index 29b9bb6977..a6b23c3ba7 100644
--- a/src/test/recovery/t/037_invalid_database.pl
+++ b/src/test/recovery/t/037_invalid_database.pl
@@ -3,7 +3,7 @@
 # Test we handle interrupted DROP DATABASE correctly.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/038_save_logical_slots_shutdown.pl b/src/test/recovery/t/038_save_logical_slots_shutdown.pl
index 52ec4e8820..f263aff5b3 100644
--- a/src/test/recovery/t/038_save_logical_slots_shutdown.pl
+++ b/src/test/recovery/t/038_save_logical_slots_shutdown.pl
@@ -5,7 +5,7 @@
 # checkpoint.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
diff --git a/src/test/recovery/t/039_end_of_wal.pl b/src/test/recovery/t/039_end_of_wal.pl
index d2bf062bb2..285aab0683 100644
--- a/src/test/recovery/t/039_end_of_wal.pl
+++ b/src/test/recovery/t/039_end_of_wal.pl
@@ -5,7 +5,7 @@
 # scenarios.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/recovery/t/cp_history_files b/src/test/recovery/t/cp_history_files
index cfeea41e5b..5832b98ef4 100644
--- a/src/test/recovery/t/cp_history_files
+++ b/src/test/recovery/t/cp_history_files
@@ -2,7 +2,7 @@
 
 use File::Copy;
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 die "wrong number of arguments" if @ARGV != 2;
 my ($source, $target) = @ARGV;
diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index d921f1dde9..4f2864da93 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Config qw ( %Config );
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
@@ -708,6 +708,8 @@ sub switch_server_cert
 	# integer like how we do when grabbing the serial fails.
 	if ($Config{ivsize} == 8)
 	{
+		no warnings qw(portable);
+
 		$serialno =~ s/^serial=//;
 		$serialno =~ s/\s+//g;
 		$serialno = hex($serialno);
diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl
index 91e771ec47..807b211f98 100644
--- a/src/test/ssl/t/002_scram.pl
+++ b/src/test/ssl/t/002_scram.pl
@@ -4,7 +4,7 @@
 # Test SCRAM authentication and TLS channel binding types
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/ssl/t/003_sslinfo.pl b/src/test/ssl/t/003_sslinfo.pl
index 5306aad802..866fe5ad2c 100644
--- a/src/test/ssl/t/003_sslinfo.pl
+++ b/src/test/ssl/t/003_sslinfo.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/ssl/t/SSL/Backend/OpenSSL.pm b/src/test/ssl/t/SSL/Backend/OpenSSL.pm
index a762f43634..a2b44f8516 100644
--- a/src/test/ssl/t/SSL/Backend/OpenSSL.pm
+++ b/src/test/ssl/t/SSL/Backend/OpenSSL.pm
@@ -25,7 +25,7 @@ for a PostgreSQL cluster compiled against OpenSSL.
 package SSL::Backend::OpenSSL;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use File::Basename;
 use File::Copy;
 
diff --git a/src/test/ssl/t/SSL/Server.pm b/src/test/ssl/t/SSL/Server.pm
index 2c5c055222..836e098902 100644
--- a/src/test/ssl/t/SSL/Server.pm
+++ b/src/test/ssl/t/SSL/Server.pm
@@ -64,7 +64,7 @@ specific infrastructure. Currently only OpenSSL is supported.
 package SSL::Server;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl
index e49da00b29..16c7fb94eb 100644
--- a/src/test/subscription/t/001_rep_changes.pl
+++ b/src/test/subscription/t/001_rep_changes.pl
@@ -3,7 +3,7 @@
 
 # Basic logical replication test
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/002_types.pl b/src/test/subscription/t/002_types.pl
index 40155ad563..e8f6044351 100644
--- a/src/test/subscription/t/002_types.pl
+++ b/src/test/subscription/t/002_types.pl
@@ -4,7 +4,7 @@
 # This tests that more complex datatypes are replicated correctly
 # by logical replication
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/003_constraints.pl b/src/test/subscription/t/003_constraints.pl
index 6e3591d486..e0c7b1051d 100644
--- a/src/test/subscription/t/003_constraints.pl
+++ b/src/test/subscription/t/003_constraints.pl
@@ -3,7 +3,7 @@
 
 # This test checks that constraints work on subscriber
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/004_sync.pl b/src/test/subscription/t/004_sync.pl
index 11269708aa..6ecbc9b729 100644
--- a/src/test/subscription/t/004_sync.pl
+++ b/src/test/subscription/t/004_sync.pl
@@ -3,7 +3,7 @@
 
 # Tests for logical replication table syncing
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/005_encoding.pl b/src/test/subscription/t/005_encoding.pl
index c9cece48c4..4836a48ca4 100644
--- a/src/test/subscription/t/005_encoding.pl
+++ b/src/test/subscription/t/005_encoding.pl
@@ -3,7 +3,7 @@
 
 # Test replication between databases with different encodings
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/006_rewrite.pl b/src/test/subscription/t/006_rewrite.pl
index 62a1bdcd15..90e81ab670 100644
--- a/src/test/subscription/t/006_rewrite.pl
+++ b/src/test/subscription/t/006_rewrite.pl
@@ -3,7 +3,7 @@
 
 # Test logical replication behavior with heap rewrites
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/007_ddl.pl b/src/test/subscription/t/007_ddl.pl
index 02e9dd61d5..241c911ac7 100644
--- a/src/test/subscription/t/007_ddl.pl
+++ b/src/test/subscription/t/007_ddl.pl
@@ -3,7 +3,7 @@
 
 # Test some logical replication DDL behavior
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/008_diff_schema.pl b/src/test/subscription/t/008_diff_schema.pl
index ed676b73e5..491352668d 100644
--- a/src/test/subscription/t/008_diff_schema.pl
+++ b/src/test/subscription/t/008_diff_schema.pl
@@ -3,7 +3,7 @@
 
 # Test behavior with different schema on subscriber
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/009_matviews.pl b/src/test/subscription/t/009_matviews.pl
index 798aad53c7..6e25b8fe90 100644
--- a/src/test/subscription/t/009_matviews.pl
+++ b/src/test/subscription/t/009_matviews.pl
@@ -3,7 +3,7 @@
 
 # Test materialized views behavior
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/010_truncate.pl b/src/test/subscription/t/010_truncate.pl
index 9eeb518b52..4d97402c8d 100644
--- a/src/test/subscription/t/010_truncate.pl
+++ b/src/test/subscription/t/010_truncate.pl
@@ -3,7 +3,7 @@
 
 # Test TRUNCATE
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/011_generated.pl b/src/test/subscription/t/011_generated.pl
index 4f8518cf35..bf54cebcd8 100644
--- a/src/test/subscription/t/011_generated.pl
+++ b/src/test/subscription/t/011_generated.pl
@@ -3,7 +3,7 @@
 
 # Test generated columns
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/012_collation.pl b/src/test/subscription/t/012_collation.pl
index dd66424be8..dc2adce8dd 100644
--- a/src/test/subscription/t/012_collation.pl
+++ b/src/test/subscription/t/012_collation.pl
@@ -4,7 +4,7 @@
 # Test collations, in particular nondeterministic ones
 # (only works with ICU)
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/013_partition.pl b/src/test/subscription/t/013_partition.pl
index 0f1a34235d..ce881f31bd 100644
--- a/src/test/subscription/t/013_partition.pl
+++ b/src/test/subscription/t/013_partition.pl
@@ -3,7 +3,7 @@
 
 # Test logical replication with partitioned tables
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/014_binary.pl b/src/test/subscription/t/014_binary.pl
index 6abc899bd9..4a04db7de2 100644
--- a/src/test/subscription/t/014_binary.pl
+++ b/src/test/subscription/t/014_binary.pl
@@ -4,7 +4,7 @@
 # Binary mode logical replication test
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/015_stream.pl b/src/test/subscription/t/015_stream.pl
index 986e879968..6d2eb76d27 100644
--- a/src/test/subscription/t/015_stream.pl
+++ b/src/test/subscription/t/015_stream.pl
@@ -3,7 +3,7 @@
 
 # Test streaming of simple large transaction
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/016_stream_subxact.pl b/src/test/subscription/t/016_stream_subxact.pl
index 561855cb42..fe255fbb07 100644
--- a/src/test/subscription/t/016_stream_subxact.pl
+++ b/src/test/subscription/t/016_stream_subxact.pl
@@ -3,7 +3,7 @@
 
 # Test streaming of transaction containing subtransactions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/017_stream_ddl.pl b/src/test/subscription/t/017_stream_ddl.pl
index 2fd4ede402..176c033ac6 100644
--- a/src/test/subscription/t/017_stream_ddl.pl
+++ b/src/test/subscription/t/017_stream_ddl.pl
@@ -6,7 +6,7 @@
 # This file is mainly to test the DDL/DML interaction of the publisher side,
 # so we didn't add a parallel apply version for the tests in this file.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/018_stream_subxact_abort.pl b/src/test/subscription/t/018_stream_subxact_abort.pl
index e115216e75..9f06217536 100644
--- a/src/test/subscription/t/018_stream_subxact_abort.pl
+++ b/src/test/subscription/t/018_stream_subxact_abort.pl
@@ -3,7 +3,7 @@
 
 # Test streaming of transaction containing multiple subtransactions and rollbacks
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/019_stream_subxact_ddl_abort.pl b/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
index cd26eee05a..ebd17a4f9b 100644
--- a/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
+++ b/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
@@ -7,7 +7,7 @@
 # This file is mainly to test the DDL/DML interaction of the publisher side,
 # so we didn't add a parallel apply version for the tests in this file.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/020_messages.pl b/src/test/subscription/t/020_messages.pl
index 6f31fe4d6f..001882d7cc 100644
--- a/src/test/subscription/t/020_messages.pl
+++ b/src/test/subscription/t/020_messages.pl
@@ -3,7 +3,7 @@
 
 # Tests that logical decoding messages
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/021_twophase.pl b/src/test/subscription/t/021_twophase.pl
index 9bcf46c7b3..cf71391318 100644
--- a/src/test/subscription/t/021_twophase.pl
+++ b/src/test/subscription/t/021_twophase.pl
@@ -3,7 +3,7 @@
 
 # logical replication of 2PC test
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/022_twophase_cascade.pl b/src/test/subscription/t/022_twophase_cascade.pl
index 75b1a62a74..76a0b4320d 100644
--- a/src/test/subscription/t/022_twophase_cascade.pl
+++ b/src/test/subscription/t/022_twophase_cascade.pl
@@ -8,7 +8,7 @@
 # Two-phase and parallel apply will be tested in 023_twophase_stream, so we
 # didn't add a parallel apply version for the tests in this file.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/023_twophase_stream.pl b/src/test/subscription/t/023_twophase_stream.pl
index 22948e6424..e440200ae3 100644
--- a/src/test/subscription/t/023_twophase_stream.pl
+++ b/src/test/subscription/t/023_twophase_stream.pl
@@ -3,7 +3,7 @@
 
 # Test logical replication of 2PC with streaming.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/024_add_drop_pub.pl b/src/test/subscription/t/024_add_drop_pub.pl
index cdb14a919a..b54a5ce340 100644
--- a/src/test/subscription/t/024_add_drop_pub.pl
+++ b/src/test/subscription/t/024_add_drop_pub.pl
@@ -3,7 +3,7 @@
 
 # This test checks behaviour of ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/025_rep_changes_for_schema.pl b/src/test/subscription/t/025_rep_changes_for_schema.pl
index 97405cd8d5..30111f2c32 100644
--- a/src/test/subscription/t/025_rep_changes_for_schema.pl
+++ b/src/test/subscription/t/025_rep_changes_for_schema.pl
@@ -3,7 +3,7 @@
 
 # Logical replication tests for schema publications
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/026_stats.pl b/src/test/subscription/t/026_stats.pl
index f31b25b4af..a7777c0de8 100644
--- a/src/test/subscription/t/026_stats.pl
+++ b/src/test/subscription/t/026_stats.pl
@@ -3,7 +3,7 @@
 
 # Tests for subscription stats.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/027_nosuperuser.pl b/src/test/subscription/t/027_nosuperuser.pl
index 642baa5d7c..9acd616ba2 100644
--- a/src/test/subscription/t/027_nosuperuser.pl
+++ b/src/test/subscription/t/027_nosuperuser.pl
@@ -3,7 +3,7 @@
 
 # Test that logical replication respects permissions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/subscription/t/028_row_filter.pl b/src/test/subscription/t/028_row_filter.pl
index 1510149f97..638ea12989 100644
--- a/src/test/subscription/t/028_row_filter.pl
+++ b/src/test/subscription/t/028_row_filter.pl
@@ -2,7 +2,7 @@
 
 # Test logical replication behavior with row filtering
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/029_on_error.pl b/src/test/subscription/t/029_on_error.pl
index fcab7386fe..d874e83896 100644
--- a/src/test/subscription/t/029_on_error.pl
+++ b/src/test/subscription/t/029_on_error.pl
@@ -3,7 +3,7 @@
 
 # Tests for disable_on_error and SKIP transaction features.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/030_origin.pl b/src/test/subscription/t/030_origin.pl
index 9ca1fa25d8..fa33f997e8 100644
--- a/src/test/subscription/t/030_origin.pl
+++ b/src/test/subscription/t/030_origin.pl
@@ -4,7 +4,7 @@
 # Test the CREATE SUBSCRIPTION 'origin' parameter and its interaction with
 # 'copy_data' parameter.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/031_column_list.pl b/src/test/subscription/t/031_column_list.pl
index 7bf83e01f4..90c321df3c 100644
--- a/src/test/subscription/t/031_column_list.pl
+++ b/src/test/subscription/t/031_column_list.pl
@@ -2,7 +2,7 @@
 
 # Test partial-column publication of tables
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/032_subscribe_use_index.pl b/src/test/subscription/t/032_subscribe_use_index.pl
index d1f65d05e5..f085e3a560 100644
--- a/src/test/subscription/t/032_subscribe_use_index.pl
+++ b/src/test/subscription/t/032_subscribe_use_index.pl
@@ -2,7 +2,7 @@
 
 # Test logical replication behavior with subscriber using available index
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/test/subscription/t/033_run_as_table_owner.pl b/src/test/subscription/t/033_run_as_table_owner.pl
index f4083202e5..3e3ee875e6 100644
--- a/src/test/subscription/t/033_run_as_table_owner.pl
+++ b/src/test/subscription/t/033_run_as_table_owner.pl
@@ -3,7 +3,7 @@
 
 # Test that logical replication respects permissions
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/subscription/t/100_bugs.pl b/src/test/subscription/t/100_bugs.pl
index d64be621e8..f061f4d68d 100644
--- a/src/test/subscription/t/100_bugs.pl
+++ b/src/test/subscription/t/100_bugs.pl
@@ -3,7 +3,7 @@
 
 # Tests for various bugs found over time
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
diff --git a/src/tools/PerfectHash.pm b/src/tools/PerfectHash.pm
index e54905a3ef..0587107962 100644
--- a/src/tools/PerfectHash.pm
+++ b/src/tools/PerfectHash.pm
@@ -30,7 +30,7 @@
 package PerfectHash;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 
 # At runtime, we'll compute two simple hash functions of the input key,
diff --git a/src/tools/check_bison_recursion.pl b/src/tools/check_bison_recursion.pl
index 18f14ad127..2f079a01a7 100755
--- a/src/tools/check_bison_recursion.pl
+++ b/src/tools/check_bison_recursion.pl
@@ -22,7 +22,7 @@
 #################################################################
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $debug = 0;
 
diff --git a/src/tools/ci/windows_build_config.pl b/src/tools/ci/windows_build_config.pl
index b0d4360c74..a3eb96b7fd 100644
--- a/src/tools/ci/windows_build_config.pl
+++ b/src/tools/ci/windows_build_config.pl
@@ -1,5 +1,5 @@
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 our $config;
 
diff --git a/src/tools/copyright.pl b/src/tools/copyright.pl
index 30c38c757b..4263b5a3eb 100755
--- a/src/tools/copyright.pl
+++ b/src/tools/copyright.pl
@@ -10,7 +10,7 @@
 #################################################################
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use File::Find;
 use File::Basename;
diff --git a/src/tools/fix-old-flex-code.pl b/src/tools/fix-old-flex-code.pl
index d88e68b8b6..c9b0517ed4 100644
--- a/src/tools/fix-old-flex-code.pl
+++ b/src/tools/fix-old-flex-code.pl
@@ -16,7 +16,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Get command line argument.
 usage() if $#ARGV != 0;
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
index ed60abe956..08f839ed07 100644
--- a/src/tools/gen_export.pl
+++ b/src/tools/gen_export.pl
@@ -1,5 +1,5 @@
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 my $format;
diff --git a/src/tools/gen_keywordlist.pl b/src/tools/gen_keywordlist.pl
index 97a9ff1b30..2ad9c9a4a3 100644
--- a/src/tools/gen_keywordlist.pl
+++ b/src/tools/gen_keywordlist.pl
@@ -29,7 +29,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use Getopt::Long;
 
 use FindBin;
diff --git a/src/tools/git_changelog b/src/tools/git_changelog
index 39e1b1fe15..f3c225d556 100755
--- a/src/tools/git_changelog
+++ b/src/tools/git_changelog
@@ -50,7 +50,7 @@
 
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 require Time::Local;
 require Getopt::Long;
 require IPC::Open2;
diff --git a/src/tools/mark_pgdllimport.pl b/src/tools/mark_pgdllimport.pl
index 45b4e73bff..a0ff7f0e2b 100755
--- a/src/tools/mark_pgdllimport.pl
+++ b/src/tools/mark_pgdllimport.pl
@@ -23,7 +23,7 @@
 #----------------------------------------------------------------------
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 for my $include_file (@ARGV)
 {
diff --git a/src/tools/msvc_gendef.pl b/src/tools/msvc_gendef.pl
index 8749fd0dd7..efdd67f67c 100644
--- a/src/tools/msvc_gendef.pl
+++ b/src/tools/msvc_gendef.pl
@@ -2,7 +2,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use List::Util qw(min);
 use Getopt::Long;
 
diff --git a/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl b/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
index fef5c86ca4..fb772cb89b 100644
--- a/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
+++ b/src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
@@ -4,7 +4,7 @@
 # Copyright (c) 2017-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd qw(getcwd);
 use File::Copy "cp";
diff --git a/src/tools/pginclude/pgcheckdefines b/src/tools/pginclude/pgcheckdefines
index a9fe79ebe5..68aa5d178e 100755
--- a/src/tools/pginclude/pgcheckdefines
+++ b/src/tools/pginclude/pgcheckdefines
@@ -23,7 +23,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd;
 use File::Basename;
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index bce63d95da..b81fbab2ab 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -3,7 +3,7 @@
 # Copyright (c) 2021-2023, PostgreSQL Global Development Group
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Cwd qw(abs_path getcwd);
 use File::Find;
diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl
index 1f0074ded5..ad0f233758 100755
--- a/src/tools/version_stamp.pl
+++ b/src/tools/version_stamp.pl
@@ -21,7 +21,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 # Major version is hard-wired into the script.  We update it when we branch
 # a new development version.
diff --git a/src/tools/win32tzlist.pl b/src/tools/win32tzlist.pl
index 657f7d4879..3a1ca4cb15 100755
--- a/src/tools/win32tzlist.pl
+++ b/src/tools/win32tzlist.pl
@@ -16,7 +16,7 @@
 #
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use Win32::Registry;
 
-- 
2.43.0

#13Peter Eisentraut
peter@eisentraut.org
In reply to: Peter Eisentraut (#12)
Re: Make all Perl warnings fatal

On 22.12.23 22:33, Peter Eisentraut wrote:

On 12.09.23 07:42, Peter Eisentraut wrote:

On 10.08.23 07:58, Peter Eisentraut wrote:

There are also a couple of issues in the MSVC legacy build system
that would need to be tightened up in order to survive with fatal
Perl warnings.  Obviously, there is a question whether it's worth
spending any time on that anymore.

It looks like there are no principled objections to the overall idea
here, but given this dependency on the MSVC build system removal, I'm
going to set this patch to Returned with feedback for now.

Now that that is done, here is an updated patch for this.

I found one more bug in the Perl code because of this, a fix for which
is included here.

With this fix, this passes all the CI tests on all platforms.

committed

#14Bharath Rupireddy
bharath.rupireddyforpostgres@gmail.com
In reply to: Peter Eisentraut (#13)
Re: Make all Perl warnings fatal

On Sat, Dec 30, 2023 at 12:57 AM Peter Eisentraut <peter@eisentraut.org> wrote:

committed

With the commit c5385929 converting perl warnings to FATAL, use of
psql/safe_psql with timeout parameters [1]use strict; use warnings FATAL => 'all'; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; use Test::More; fail with the following
error:

Use of uninitialized value $ret in bitwise and (&) at
/home/ubuntu/postgres/src/test/recovery/../../../src/test/perl/PostgreSQL/Test/Cluster.pm
line 2015.

Perhaps assigning a default error code to $ret instead of undef in
PostgreSQL::Test::Cluster - psql() function is the solution.

[1]: use strict; use warnings FATAL => 'all'; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; use Test::More;
use strict;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

my $node = PostgreSQL::Test::Cluster->new('test');
$node->init;
$node->start;

my ($stdout, $stderr, $timed_out);
my $cmdret = $node->psql('postgres', q[SELECT pg_sleep(600)],
stdout => \$stdout, stderr => \$stderr,
timeout => 5,
timed_out => \$timed_out,
extra_params => ['--single-transaction'],
on_error_die => 1);
print "pg_sleep timed out" if $timed_out;

done_testing();

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

#15Peter Eisentraut
peter@eisentraut.org
In reply to: Bharath Rupireddy (#14)
Re: Make all Perl warnings fatal

On 11.01.24 12:29, Bharath Rupireddy wrote:

On Sat, Dec 30, 2023 at 12:57 AM Peter Eisentraut <peter@eisentraut.org> wrote:

committed

With the commit c5385929 converting perl warnings to FATAL, use of
psql/safe_psql with timeout parameters [1] fail with the following
error:

Use of uninitialized value $ret in bitwise and (&) at
/home/ubuntu/postgres/src/test/recovery/../../../src/test/perl/PostgreSQL/Test/Cluster.pm
line 2015.

I think what is actually relevant is the timed_out parameter, otherwise
the psql/safe_psql function ends up calling "die" and you don't get any
further.

Perhaps assigning a default error code to $ret instead of undef in
PostgreSQL::Test::Cluster - psql() function is the solution.

I would put this code

my $core = $ret & 128 ? " (core dumped)" : "";
die "psql exited with signal "
. ($ret & 127)
. "$core: '$$stderr' while running '@psql_params'"
if $ret & 127;
$ret = $ret >> 8;

inside a if (defined $ret) block.

Then the behavior would be that the whole function returns undef on
timeout, which is usefully different from returning 0 (and matches
previous behavior).

#16Bharath Rupireddy
bharath.rupireddyforpostgres@gmail.com
In reply to: Peter Eisentraut (#15)
Re: Make all Perl warnings fatal

On Fri, Jan 12, 2024 at 9:03 PM Peter Eisentraut <peter@eisentraut.org> wrote:

On 11.01.24 12:29, Bharath Rupireddy wrote:

On Sat, Dec 30, 2023 at 12:57 AM Peter Eisentraut <peter@eisentraut.org> wrote:

committed

With the commit c5385929 converting perl warnings to FATAL, use of
psql/safe_psql with timeout parameters [1] fail with the following
error:

Use of uninitialized value $ret in bitwise and (&) at
/home/ubuntu/postgres/src/test/recovery/../../../src/test/perl/PostgreSQL/Test/Cluster.pm
line 2015.

I think what is actually relevant is the timed_out parameter, otherwise
the psql/safe_psql function ends up calling "die" and you don't get any
further.

Perhaps assigning a default error code to $ret instead of undef in
PostgreSQL::Test::Cluster - psql() function is the solution.

I would put this code

my $core = $ret & 128 ? " (core dumped)" : "";
die "psql exited with signal "
. ($ret & 127)
. "$core: '$$stderr' while running '@psql_params'"
if $ret & 127;
$ret = $ret >> 8;

inside a if (defined $ret) block.

Then the behavior would be that the whole function returns undef on
timeout, which is usefully different from returning 0 (and matches
previous behavior).

WFM.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

#17Bharath Rupireddy
bharath.rupireddyforpostgres@gmail.com
In reply to: Bharath Rupireddy (#16)
1 attachment(s)
Re: Make all Perl warnings fatal

On Fri, Jan 12, 2024 at 9:21 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:

On Fri, Jan 12, 2024 at 9:03 PM Peter Eisentraut <peter@eisentraut.org> wrote:

I would put this code

my $core = $ret & 128 ? " (core dumped)" : "";
die "psql exited with signal "
. ($ret & 127)
. "$core: '$$stderr' while running '@psql_params'"
if $ret & 127;
$ret = $ret >> 8;

inside a if (defined $ret) block.

Then the behavior would be that the whole function returns undef on
timeout, which is usefully different from returning 0 (and matches
previous behavior).

WFM.

I've attached a patch for the above change.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachments:

v1-0001-Fix-an-issue-in-PostgreSQL-Test-Cluster-psql.patchapplication/octet-stream; name=v1-0001-Fix-an-issue-in-PostgreSQL-Test-Cluster-psql.patchDownload
From df6bfd8a3958f20c4a13eda4eab3e1b5dce47e4f Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Tue, 16 Jan 2024 11:05:41 +0000
Subject: [PATCH v1] Fix an issue in PostgreSQL::Test::Cluster:psql()

Due to the commit c5385929 which made all Perl warnings to fatal,
use of PostgreSQL::Test::Cluster:psql() and safe_psql() with
timeout started to fail with the following error:

Use of uninitialized value $ret in bitwise and (&) at
..src/test/perl/PostgreSQL/Test/Cluster.pm line 2015.

Fix that by placing $ret conversion code in psql() in an
if (defined $ret) block.

With this change, the behavior of psql() becomes same as before,
that is, the whole function returns undef on timeout, which is
usefully different from returning 0.
---
 src/test/perl/PostgreSQL/Test/Cluster.pm | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 406c405015..e2e70d0dbf 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -2012,12 +2012,15 @@ sub psql
 	# We don't use IPC::Run::Simple to limit dependencies.
 	#
 	# We always die on signal.
-	my $core = $ret & 128 ? " (core dumped)" : "";
-	die "psql exited with signal "
-	  . ($ret & 127)
-	  . "$core: '$$stderr' while running '@psql_params'"
-	  if $ret & 127;
-	$ret = $ret >> 8;
+	if (defined $ret)
+	{
+		my $core = $ret & 128 ? " (core dumped)" : "";
+		die "psql exited with signal "
+		  . ($ret & 127)
+		  . "$core: '$$stderr' while running '@psql_params'"
+		  if $ret & 127;
+		$ret = $ret >> 8;
+	}
 
 	if ($ret && $params{on_error_die})
 	{
-- 
2.34.1

#18Peter Eisentraut
peter@eisentraut.org
In reply to: Bharath Rupireddy (#17)
Re: Make all Perl warnings fatal

On 16.01.24 12:08, Bharath Rupireddy wrote:

On Fri, Jan 12, 2024 at 9:21 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:

On Fri, Jan 12, 2024 at 9:03 PM Peter Eisentraut <peter@eisentraut.org> wrote:

I would put this code

my $core = $ret & 128 ? " (core dumped)" : "";
die "psql exited with signal "
. ($ret & 127)
. "$core: '$$stderr' while running '@psql_params'"
if $ret & 127;
$ret = $ret >> 8;

inside a if (defined $ret) block.

Then the behavior would be that the whole function returns undef on
timeout, which is usefully different from returning 0 (and matches
previous behavior).

WFM.

I've attached a patch for the above change.

Committed, thanks.

#19Anton Voloshin
a.voloshin@postgrespro.ru
In reply to: Peter Eisentraut (#18)
1 attachment(s)
Re: Make all Perl warnings fatal

Hello,

On 18/01/2024 10:52, Peter Eisentraut wrote:

Committed, thanks.

since this patch two .pl files without FATAL in "use warnings" have been
committed to master:
src/test/recovery/t/043_wal_replay_wait.pl
src/test/modules/test_misc/t/006_signal_autovacuum.pl

They come from
commit 06c418e163e913966e17cb2d3fb1c5f8a8d58308
Author: Alexander Korotkov <akorotkov@postgresql.org>
Date: Tue Apr 2 22:48:03 2024

Implement pg_wal_replay_wait() stored procedure

and

commit d2b74882cab84b9f4fdce0f2f32e892ba9164f5c
Author: Michael Paquier <michael@paquier.xyz>
Date: Tue Jul 16 04:05:46 2024

Add tap test for pg_signal_autovacuum role

An obvious patch adding FATAL => 'all' is attached.

Cc Alexander Korotkov and Michael Paquier as committers of those commits.

--
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ru

P.S. For what it's worth, this is an adapted snippet from a bash script
from our (postgrespro.com) internal CI used to detect those in
REL_17_STABLE+. It detects:
1. .pl .pm files without "use warnings"
2. .pl .pm files where "use warnings" does not have FATAL => 'all'

EXIT_CODE=0
LOG=ci_perl_files_without_warnings.log
grep --include='*.p[lm]' -R -L -w "^\s*use warnings" . | \
sed -e 's,^\./,,' | \
grep -v -F src/pl/plperl/plc_trusted.pl \

"$LOG"

if [ -s "$LOG" ]; then
N=$(wc -l < "$LOG");
echo "ERROR: \"use warnings\" is missing in the following $N Perl
files:";
cat "$LOG";
EXIT_CODE=1;
fi
# force "FATAL => 'all'" after any "use warnings" in Perl files
find . -name '*.p[lm]' -exec perl -i -p -e$'
s/^(\s*)
use \s+ warnings
(?! \s+ FATAL \s* => \s* \'all\' \s* );
/$1use warnings FATAL => \'all\';/x' {} \+;
PATCH_FILE=ci_perl_warnings.patch
git diff > "$PATCH_FILE"
if [ -s "$PATCH_FILE" ]; then
N=$(grep ^diff "$PATCH_FILE" | wc -l);
echo "ERROR: missing \"FATAL => 'all'\" in \"use warnings\" in the
following $N files:";
git status --porcelain | awk '/^ M/{print $2}';
PATCH_URL="$CI_JOB_URL/artifacts/file/$PATCH_FILE";
echo "NOTE: see $PATCH_URL for a suggested patch.";
EXIT_CODE=1;
fi
exit "$EXIT_CODE"

Please let me know if you think it's worth adapting into our general
cirrus pipeline. I'm not quite sure how to fit it yet.

I've added src/pl/plperl/plc_trusted.pl as an exception to the "contains
use warnings" check. It has require warnings, though. That's probably a
reasonable exception.

P.P.S. REL_17_STABLE is fine: all use warnings do have FATAL => 'all'.

Attachments:

0001-add-missing-FATAL-all-to-couple-of-use-warnings-in-P.patchtext/x-patch; charset=UTF-8; name=0001-add-missing-FATAL-all-to-couple-of-use-warnings-in-P.patchDownload
From 03876d72a1d45e8228f4a13805650c2a92ff46e3 Mon Sep 17 00:00:00 2001
From: Anton Voloshin <a.voloshin@postgrespro.ru>
Date: Tue, 22 Oct 2024 12:05:27 +0300
Subject: [PATCH] add missing FATAL => 'all' to couple of use warnings in Perl

---
 src/test/modules/test_misc/t/006_signal_autovacuum.pl | 2 +-
 src/test/recovery/t/043_wal_replay_wait.pl            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/modules/test_misc/t/006_signal_autovacuum.pl b/src/test/modules/test_misc/t/006_signal_autovacuum.pl
index aaea569c101..04b06bfc2ad 100644
--- a/src/test/modules/test_misc/t/006_signal_autovacuum.pl
+++ b/src/test/modules/test_misc/t/006_signal_autovacuum.pl
@@ -7,7 +7,7 @@
 # at the beginning of the autovacuum worker startup.
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 use PostgreSQL::Test::Cluster;
 use Test::More;
 
diff --git a/src/test/recovery/t/043_wal_replay_wait.pl b/src/test/recovery/t/043_wal_replay_wait.pl
index 024f1fe6488..cf77a9eec70 100644
--- a/src/test/recovery/t/043_wal_replay_wait.pl
+++ b/src/test/recovery/t/043_wal_replay_wait.pl
@@ -1,7 +1,7 @@
 # Checks waiting for the lsn replay on standby using
 # pg_wal_replay_wait() procedure.
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
-- 
2.46.2

#20Alexander Korotkov
aekorotkov@gmail.com
In reply to: Anton Voloshin (#19)
Re: Make all Perl warnings fatal

Hi!

On Tue, Oct 22, 2024 at 12:26 PM Anton Voloshin
<a.voloshin@postgrespro.ru> wrote:

On 18/01/2024 10:52, Peter Eisentraut wrote:

Committed, thanks.

since this patch two .pl files without FATAL in "use warnings" have been
committed to master:
src/test/recovery/t/043_wal_replay_wait.pl
src/test/modules/test_misc/t/006_signal_autovacuum.pl

Thank you for spotting this.
I have just changed relevant line in 043_wal_replay_wait.pl.

------
Regards,
Alexander Korotkov
Supabase

#21Peter Eisentraut
peter@eisentraut.org
In reply to: Anton Voloshin (#19)
Re: Make all Perl warnings fatal

On 22.10.24 11:25, Anton Voloshin wrote:

Hello,

On 18/01/2024 10:52, Peter Eisentraut wrote:

Committed, thanks.

since this patch two .pl files without FATAL in "use warnings" have been
committed to master:
src/test/recovery/t/043_wal_replay_wait.pl
src/test/modules/test_misc/t/006_signal_autovacuum.pl

They come from
commit 06c418e163e913966e17cb2d3fb1c5f8a8d58308
Author: Alexander Korotkov <akorotkov@postgresql.org>
Date:   Tue Apr 2 22:48:03 2024

    Implement pg_wal_replay_wait() stored procedure

and

commit d2b74882cab84b9f4fdce0f2f32e892ba9164f5c
Author: Michael Paquier <michael@paquier.xyz>
Date:   Tue Jul 16 04:05:46 2024

    Add tap test for pg_signal_autovacuum role

An obvious patch adding FATAL => 'all' is attached.

Thanks, I committed the rest of this.