Subject: Re: Typos in the code and README

From: Alexander Lakhin <[email-masked]>
Date: Mon, 2 Sep 2024 21:00:00 +0300

Hello,

12.08.2024 14:59, David Rowley wrote:
> (I know Daniel mentioned he'd get to these, but the ScanDirection one
> was my fault and I needed to clear that off my mind. I did a few
> others while on this topic.)

Thank you, David, for working on that!

I've gathered another bunch of defects with the possible substitutions.
Please take a look:
adapated -> adapted

becasue -> because

cancelled -> canceled (introduced by 90f517821, but see 8c9da1441)

cange -> change

comand -> command

CommitTSSLRU -> CommitTsSLRU (introduced by 53c2a97a9; maybe the fix
  should be back-patched...)

connectOptions2 -> pqConnectOptions2 (see 774bcffe4)

Injections points -> Injection points

jsetate -> jsestate

LockShmemSize -> remove the sentence? (added by ec0baf949, outdated with
  a794fb068)

MaybeStartSlotSyncWorker -> LaunchMissingBackgroundProcesses (the logic to
  start B_SLOTSYNC_WORKER moved from the former to the latter function with
  3354f8528)

multixact_member_buffer -> multixact_member_buffers

per_data_data -> per_buffer_data (see code below the comment; introduced by
  b5a9b18cd)

per_buffer_private -> remove the function declaration? (the duplicate
  declaration was added by a858be17c)

performancewise -> performance-wise? (coined by a7f107df2)

pgstat_add_kind -> pgstat_register_kind (see 7949d9594)

pg_signal_autovacuum -> pg_signal_autovacuum_worker (see d2b74882c)

recoveery -> recovery

RegisteredWorker -> RegisteredBgWorker

RUNNING_XACT -> RUNNING_XACTS

sanpshot -> snapshot

TypeEntry -> TypeCacheEntry (align with AttoptCacheEntry, from the same
  commit 40064a8ee)

The corresponding patch is attached for your convenience.

Best regards,
Alexander

diff --git a/contrib/test_decoding/specs/skip_snapshot_restore.spec b/contrib/test_decoding/specs/skip_snapshot_restore.spec
index 3f1fb6f02c7..7b35dbcc9f3 100644
--- a/contrib/test_decoding/specs/skip_snapshot_restore.spec
+++ b/contrib/test_decoding/specs/skip_snapshot_restore.spec
@@ -39,7 +39,7 @@ step "s2_get_changes_slot0" { SELECT data FROM pg_logical_slot_get_changes('slot
 # serializes consistent snapshots to the disk at LSNs where are before
 # s0-transaction's commit. After s0-transaction commits, "s1_init" resumes but
 # must not restore any serialized snapshots and will reach the consistent state
-# when decoding a RUNNING_XACT record generated after s0-transaction's commit.
+# when decoding a RUNNING_XACTS record generated after s0-transaction's commit.
 # We check if the get_changes on 'slot1' will not return any s0-transaction's
 # changes as its confirmed_flush_lsn will be after the s0-transaction's commit
 # record.
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index 9bc23a9a938..af7864a1b5b 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -3891,8 +3891,8 @@ static const PgStat_KindInfo custom_stats = {
      it with <literal>pgstat_register_kind</literal> and a unique ID used to
      store the entries related to this type of statistics:
 <programlisting>
-extern PgStat_Kind pgstat_add_kind(PgStat_Kind kind,
-                                   const PgStat_KindInfo *kind_info);
+extern PgStat_Kind pgstat_register_kind(PgStat_Kind kind,
+                                        const PgStat_KindInfo *kind_info);
 </programlisting>
      While developing a new extension, use
      <literal>PGSTAT_KIND_EXPERIMENTAL</literal> for
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index a03d56541d0..8c37d7eba76 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -2017,7 +2017,7 @@ check_multixact_offset_buffers(int *newval, void **extra, GucSource source)
 }
 
 /*
- * GUC check_hook for multixact_member_buffer
+ * GUC check_hook for multixact_member_buffers
  */
 bool
 check_multixact_member_buffers(int *newval, void **extra, GucSource source)
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index 91f0fd6ea3e..b2457f121a7 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -382,7 +382,7 @@ RefreshMatViewByOid(Oid matviewOid, bool is_create, bool skipData,
 	 * command tag is left false in cmdtaglist.h. Otherwise, the change of
 	 * completion tag output might break applications using it.
 	 *
-	 * When called from CREATE MATERIALIZED VIEW comand, the rowcount is
+	 * When called from CREATE MATERIALIZED VIEW command, the rowcount is
 	 * displayed with the command tag CMDTAG_SELECT.
 	 */
 	if (qc)
diff --git a/src/backend/commands/waitlsn.c b/src/backend/commands/waitlsn.c
index d9cf9e7d75e..d7065726749 100644
--- a/src/backend/commands/waitlsn.c
+++ b/src/backend/commands/waitlsn.c
@@ -369,7 +369,7 @@ pg_wal_replay_wait(PG_FUNCTION_ARGS)
 	 */
 	InvalidateCatalogSnapshot();
 
-	/* Give up if there is still an active or registered sanpshot. */
+	/* Give up if there is still an active or registered snapshot. */
 	if (GetOldestSnapshot())
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c
index 77394e76c37..a6c47f61e0d 100644
--- a/src/backend/executor/execExprInterp.c
+++ b/src/backend/executor/execExprInterp.c
@@ -1101,7 +1101,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
 
 		EEO_CASE(EEOP_PARAM_SET)
 		{
-			/* out of line, unlikely to matter performancewise */
+			/* out of line, unlikely to matter performance-wise */
 			ExecEvalParamSet(state, op, econtext);
 			EEO_NEXT();
 		}
@@ -4762,7 +4762,7 @@ ExecEvalJsonCoercionFinish(ExprState *state, ExprEvalStep *op)
 	if (SOFT_ERROR_OCCURRED(&jsestate->escontext))
 	{
 		/*
-		 * jsestate->error or jsetate->empty being set means that the error
+		 * jsestate->error or jsestate->empty being set means that the error
 		 * occurred when coercing the JsonBehavior value.  Throw the error in
 		 * that case with the actual coercion error message shown in the
 		 * DETAIL part.
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index a6fff93db34..59da773ee1f 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2628,7 +2628,7 @@ CleanupBackend(Backend *bp,
 		BackgroundWorkerStopNotifications(bp->pid);
 
 	/*
-	 * If it was a background worker, also update its RegisteredWorker entry.
+	 * If it was a background worker, also update its RegisteredBgWorker entry.
 	 */
 	if (bp->bkend_type == BACKEND_TYPE_BGWORKER)
 	{
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 51072297fd3..33378bacea6 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -83,7 +83,7 @@
  * this flag is set. Note that we don't need to reset this variable as after
  * promotion the slot sync worker won't be restarted because the pmState
  * changes to PM_RUN from PM_HOT_STANDBY and we don't support demoting
- * primary without restarting the server. See MaybeStartSlotSyncWorker.
+ * primary without restarting the server. See LaunchMissingBackgroundProcesses.
  *
  * The 'syncing' flag is needed to prevent concurrent slot syncs to avoid slot
  * overwrites.
diff --git a/src/backend/storage/aio/read_stream.c b/src/backend/storage/aio/read_stream.c
index 93cdd35fea0..064861e5fb7 100644
--- a/src/backend/storage/aio/read_stream.c
+++ b/src/backend/storage/aio/read_stream.c
@@ -449,7 +449,7 @@ read_stream_begin_impl(int flags,
 	queue_size = max_pinned_buffers + 1;
 
 	/*
-	 * Allocate the object, the buffers, the ios and per_data_data space in
+	 * Allocate the object, the buffers, the ios and per_buffer_data space in
 	 * one big chunk.  Though we have queue_size buffers, we want to be able
 	 * to assume that all the buffers for a single read are contiguous (i.e.
 	 * don't wrap around halfway through), so we allow temporary overflows of
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 6dbc41dae70..c239888eec6 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -395,8 +395,7 @@ LockManagerShmemInit(void)
 	bool		found;
 
 	/*
-	 * Compute init/max size to request for lock hashtables.  Note these
-	 * calculations must agree with LockShmemSize!
+	 * Compute init/max size to request for lock hashtables.
 	 */
 	max_table_size = NLOCKENTS();
 	init_table_size = max_table_size / 2;
diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c
index e765754d805..db6ed784ab3 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -158,7 +158,7 @@ static const char *const BuiltinTrancheNames[] = {
 	[LWTRANCHE_LAUNCHER_HASH] = "LogicalRepLauncherHash",
 	[LWTRANCHE_DSM_REGISTRY_DSA] = "DSMRegistryDSA",
 	[LWTRANCHE_DSM_REGISTRY_HASH] = "DSMRegistryHash",
-	[LWTRANCHE_COMMITTS_SLRU] = "CommitTSSLRU",
+	[LWTRANCHE_COMMITTS_SLRU] = "CommitTsSLRU",
 	[LWTRANCHE_MULTIXACTOFFSET_SLRU] = "MultixactOffsetSLRU",
 	[LWTRANCHE_MULTIXACTMEMBER_SLRU] = "MultixactMemberSLRU",
 	[LWTRANCHE_NOTIFY_SLRU] = "NotifySLRU",
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index 0b9e60845b2..2ec136b7d30 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -367,9 +367,9 @@ lookup_type_cache(Oid type_id, int flags)
 		ctl.entrysize = sizeof(TypeCacheEntry);
 
 		/*
-		 * TypeEntry takes hash value from the system cache. For TypeCacheHash
-		 * we use the same hash in order to speedup search by hash value. This
-		 * is used by hash_seq_init_with_hash_value().
+		 * TypeCacheEntry takes hash value from the system cache. For
+		 * TypeCacheHash we use the same hash in order to speedup search by
+		 * hash value. This is used by hash_seq_init_with_hash_value().
 		 */
 		ctl.hash = type_cache_syshash;
 
diff --git a/src/bin/pg_combinebackup/t/008_promote.pl b/src/bin/pg_combinebackup/t/008_promote.pl
index 1154a5d8b22..0ee96ff037c 100644
--- a/src/bin/pg_combinebackup/t/008_promote.pl
+++ b/src/bin/pg_combinebackup/t/008_promote.pl
@@ -54,7 +54,7 @@ recovery_target_action = 'pause'
 EOM
 $node2->start();
 
-# Wait until recoveery pauses, then promote.
+# Wait until recovery pauses, then promote.
 $node2->poll_query_until('postgres', "SELECT pg_get_wal_replay_pause_state() = 'paused';");
 $node2->safe_psql('postgres', "SELECT pg_promote()");
 
@@ -65,7 +65,7 @@ INSERT INTO mytable VALUES (2, 'blackberry');
 EOM
 
 # Now take an incremental backup. If WAL summarization didn't follow the
-# timeline cange correctly, something should break at this point.
+# timeline change correctly, something should break at this point.
 my $backup2path = $node1->backup_dir . '/backup2';
 $node2->command_ok(
 	[ 'pg_basebackup', '-D', $backup2path, '--no-sync', '-cfast',
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index be265aa05a4..066dccbd841 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -1715,7 +1715,7 @@ ExecQueryAndProcessResults(const char *query,
 			{
 				/*
 				 * Display the current chunk of results, unless the output
-				 * stream stopped working or we got cancelled.  We skip use of
+				 * stream stopped working or we got canceled.  We skip use of
 				 * PrintQueryResult and go directly to printQuery, so that we
 				 * can pass the correct is_pager value and because we don't
 				 * want PrintQueryStatus to happen yet.  Above, we rejected
diff --git a/src/fe_utils/astreamer_gzip.c b/src/fe_utils/astreamer_gzip.c
index 0d12b9bce7a..ca5be6423a1 100644
--- a/src/fe_utils/astreamer_gzip.c
+++ b/src/fe_utils/astreamer_gzip.c
@@ -13,7 +13,7 @@
  * taken here is less flexible, because a writer can only write to a file,
  * while a compressor can write to a subsequent astreamer which is free
  * to do whatever it likes. The reason it's like this is because this
- * code was adapated from old, less-modular pg_basebackup code that used
+ * code was adapted from old, less-modular pg_basebackup code that used
  * the same APIs that astreamer_gzip_writer now uses, and it didn't seem
  * necessary to change anything at the time.
  *
diff --git a/src/include/storage/read_stream.h b/src/include/storage/read_stream.h
index 4e599904f26..42a623bfc54 100644
--- a/src/include/storage/read_stream.h
+++ b/src/include/storage/read_stream.h
@@ -66,7 +66,6 @@ extern ReadStream *read_stream_begin_smgr_relation(int flags,
 												   ReadStreamBlockNumberCB callback,
 												   void *callback_private_data,
 												   size_t per_buffer_data_size);
-extern Buffer read_stream_next_buffer(ReadStream *stream, void **per_buffer_private);
 extern void read_stream_reset(ReadStream *stream);
 extern void read_stream_end(ReadStream *stream);
 
diff --git a/src/include/utils/injection_point.h b/src/include/utils/injection_point.h
index b4fc677c9b4..b1f06b25998 100644
--- a/src/include/utils/injection_point.h
+++ b/src/include/utils/injection_point.h
@@ -12,7 +12,7 @@
 #define INJECTION_POINT_H
 
 /*
- * Injections points require --enable-injection-points.
+ * Injection points require --enable-injection-points.
  */
 #ifdef USE_INJECTION_POINTS
 #define INJECTION_POINT_LOAD(name) InjectionPointLoad(name)
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 3fa2dd864fe..9febdaa2885 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -948,7 +948,7 @@ fillPGconn(PGconn *conn, PQconninfoOption *connOptions)
  * Copy over option values from srcConn to dstConn
  *
  * Don't put anything cute here --- intelligence should be in
- * connectOptions2 ...
+ * pqConnectOptions2 ...
  *
  * Returns true on success. On failure, returns false and sets error message of
  * dstConn.
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 51bdefe24aa..929253f7542 100644
--- a/src/test/modules/test_misc/t/006_signal_autovacuum.pl
+++ b/src/test/modules/test_misc/t/006_signal_autovacuum.pl
@@ -67,7 +67,7 @@ like(
 
 my $offset = -s $node->logfile;
 
-# Role with pg_signal_autovacuum can terminate autovacuum worker.
+# Role with pg_signal_autovacuum_worker can terminate autovacuum worker.
 my $terminate_with_pg_signal_av = $node->psql(
 	'postgres', qq(
     SET ROLE regress_worker_role;
diff --git a/src/test/subscription/t/021_twophase.pl b/src/test/subscription/t/021_twophase.pl
index 19147f31e21..98fe59ac5a4 100644
--- a/src/test/subscription/t/021_twophase.pl
+++ b/src/test/subscription/t/021_twophase.pl
@@ -76,7 +76,7 @@ $node_publisher->safe_psql(
 	INSERT INTO tab_full VALUES (11);
 	PREPARE TRANSACTION 'test_prepared_tab_full';");
 
-# Confirm the ERROR is reported becasue max_prepared_transactions is zero
+# Confirm the ERROR is reported because max_prepared_transactions is zero
 $node_subscriber->wait_for_log(
 	qr/ERROR: ( [A-Z0-9]+:)? prepared transactions are disabled/);

---

From: Michael Paquier <[email-masked]>
Date: Tue, 3 Sep 2024 14:24:32 +0900

> pgstat_add_kind -> pgstat_register_kind (see 7949d9594)

And here I thought I took care of these inconsistencies.  This one is
on me so I'll go fix that in a bit, with the rest while on it.
--
Michael

---

From: Michael Paquier <[email-masked]>
Date: Tue, 3 Sep 2024 14:51:40 +0900

> on me so I'll go fix that in a bit, with the rest while on it.

And done that.

The bit about CommitTSSLRU -> CommitTsSLRU in lwlock.c should be
backpatched down to 17, indeed, but the branch is frozen until the RC
tag lands in the tree, so I have left it out for now. The tag should
show up tomorrow or so.  Good thing that you have noticed this issue
before the release.
--
Michael

---

From: Daniel Gustafsson <[email-masked]>
Date: Tue, 3 Sep 2024 12:00:13 +0200

> On 3 Sep 2024, at 07:51, Michael Paquier <[email-masked]> wrote:
> 

I see your v17 typo fixes, and raise you a few more.  Commit 31a98934d169 from
just now contains 2 (out of 3) sets of typos introduced in v17 so they should
follow along when you push the ones mentioned here.

--
Daniel Gustafsson

---

From: Michael Paquier <[email-masked]>
Date: Wed, 4 Sep 2024 10:25:17 +0900

> follow along when you push the ones mentioned here.

Is that really mandatory?  I tend to worry about back branches only
when this stuff is user-visible, like in the docs or error messages.
This opinion varies for each individual, of course.  That's just my
lazy opinion.

CommitTSSLRU -> CommitTsSLRU is user-visible, showing up in
pg_stat_activity.  Fixed this one with 08b9b9e043bb, as the tag for
17rc1 has been pushed.

Picking f747bc18f7f2 and 75c5231a00f3 on REL_17_STABLE leads to the
attached, I think, without the conflicts.
--
Michael
From f747bc18f7f205795177cce6a93e19169bd0467f Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email-masked]>
Date: Tue, 3 Sep 2024 14:49:04 +0900
Subject: [PATCH 1/2] Fix typos and grammar in code comments and docs

Author: Alexander Lakhin
Discussion: https://postgr.es/m/[email-masked]
---
 src/include/utils/injection_point.h                    | 2 +-
 src/backend/access/transam/multixact.c                 | 2 +-
 src/backend/executor/execExprInterp.c                  | 2 +-
 src/backend/replication/logical/slotsync.c             | 2 +-
 src/backend/storage/aio/read_stream.c                  | 2 +-
 src/backend/storage/lmgr/lock.c                        | 2 +-
 src/bin/pg_combinebackup/t/008_promote.pl              | 4 ++--
 src/bin/psql/common.c                                  | 2 +-
 src/interfaces/libpq/fe-connect.c                      | 2 +-
 src/test/subscription/t/021_twophase.pl                | 2 +-
 contrib/test_decoding/specs/skip_snapshot_restore.spec | 2 +-
 11 files changed, 12 insertions(+), 12 deletions(-)

index 6e417cedc6..8041e4fe0f 100644
 
 /*
- * Injections points require --enable-injection-points.
+ * Injection points require --enable-injection-points.
  */
 #ifdef USE_INJECTION_POINTS
 #define INJECTION_POINT(name) InjectionPointRun(name)
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index b7b47ef076..42ea9ba5b4 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -2009,7 +2009,7 @@ check_multixact_offset_buffers(int *newval, void **extra, GucSource source)
 }
 
 /*
index c32ac7c509..ff76e10bd3 100644
@@ -4626,7 +4626,7 @@ ExecEvalJsonCoercionFinish(ExprState *state, ExprEvalStep *op)
index ebfbaebe16..fe0478e373 100644
index a6c50b2ae2..f04c788a46 100644
@@ -450,7 +450,7 @@ read_stream_begin_relation(int flags,
 
 	/*
index 0400a50777..ba77c71baa 100644
@@ -398,7 +398,7 @@ InitLocks(void)
 
 	/*
 	 * Compute init/max size to request for lock hashtables.  Note these
-	 * calculations must agree with LockShmemSize!
+	 * calculations must agree with LockManagerShmemSize!
 	 */
 	max_table_size = NLOCKENTS();
 	init_table_size = max_table_size / 2;
diff --git a/src/bin/pg_combinebackup/t/008_promote.pl b/src/bin/pg_combinebackup/t/008_promote.pl
index 1154a5d8b2..0ee96ff037 100644
--- a/src/bin/pg_combinebackup/t/008_promote.pl
+++ b/src/bin/pg_combinebackup/t/008_promote.pl
@@ -54,7 +54,7 @@ recovery_target_action = 'pause'
 EOM
 $node2->start();

 
index fe8e049c4c..ba8244aba2 100644
@@ -1680,7 +1680,7 @@ ExecQueryAndProcessResults(const char *query,
index 360d9a4547..01bd48a675 100644
@@ -947,7 +947,7 @@ fillPGconn(PGconn *conn, PQconninfoOption *connOptions)
index e635be74c6..0cdafc9791 100644

index 3f1fb6f02c..7b35dbcc9f 100644
2.45.2

From 75c5231a00f3a1cb84a18320f15fa0284d9b1235 Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <[email-masked]>
Date: Tue, 3 Sep 2024 11:33:38 +0200
Subject: [PATCH 2/2] Fix typos in code comments and test data

The typos in 005_negotiate_encryption.pl and pg_combinebackup.c
shall be backported to v17 where they were introduced.

Backpatch-through: v17
Discussion: https://postgr.es/m/[email-masked]
---
 src/bin/pg_combinebackup/pg_combinebackup.c        | 2 +-
 src/interfaces/libpq/t/005_negotiate_encryption.pl | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c
index a29ed23f3e..ea47c0a369 100644
--- a/src/bin/pg_combinebackup/pg_combinebackup.c
+++ b/src/bin/pg_combinebackup/pg_combinebackup.c
@@ -849,7 +849,7 @@ process_directory_recursively(Oid tsoid,
 	 *
 	 * We set is_pg_wal for the toplevel WAL directory and all of its
 	 * subdirectories, because those files are not included in the backup
-	 * manifest and hence need special treatement. (Since incremental backup
+	 * manifest and hence need special treatment. (Since incremental backup
 	 * does not exist in pre-v10 versions, we don't have to worry about the
 	 * old pg_xlog naming.)
 	 *
diff --git a/src/interfaces/libpq/t/005_negotiate_encryption.pl b/src/interfaces/libpq/t/005_negotiate_encryption.pl
index c3f70d31bc..294730e360 100644
--- a/src/interfaces/libpq/t/005_negotiate_encryption.pl
+++ b/src/interfaces/libpq/t/005_negotiate_encryption.pl
@@ -239,7 +239,7 @@ testuser    disable      disable      postgres       connect, authok
 .           .            require      postgres       connect, sslreject          -> fail
 .           .            .            direct         connect, directsslreject    -> fail
 
-# sslnegotiation=direct is not acccepted unless sslmode=require or stronger
+# sslnegotiation=direct is not accepted unless sslmode=require or stronger
 *           *            disable      direct         -     -> fail
 *           *            allow        direct         -     -> fail
 *           *            prefer       direct         -     -> fail
@@ -302,7 +302,7 @@ nossluser   .            disable      postgres       connect, authok
 .           .            require      postgres       connect, sslaccept, authfail                    -> fail
 .           .            require      direct         connect, directsslaccept, authfail              -> fail
 
-# sslnegotiation=direct is not acccepted unless sslmode=require or stronger
+# sslnegotiation=direct is not accepted unless sslmode=require or stronger
 *           *            disable      direct         -     -> fail
 *           *            allow        direct         -     -> fail
 *           *            prefer       direct         -     -> fail
@@ -376,7 +376,7 @@ nogssuser   disable      disable      postgres       connect, authok
 .           .            require      postgres       connect, gssaccept, authfail -> fail   # If both GSSAPI and sslmode are required, and GSS is not available -> fail
 .           .            .            direct         connect, gssaccept, authfail -> fail   # If both GSSAPI and sslmode are required, and GSS is not available -> fail
 
-# sslnegotiation=direct is not acccepted unless sslmode=require or stronger
+# sslnegotiation=direct is not accepted unless sslmode=require or stronger
 *           *            disable      direct         -     -> fail
 *           *            allow        direct         -     -> fail
 *           *            prefer       direct         -     -> fail
@@ -501,7 +501,7 @@ nossluser   disable      disable      postgres       connect, authok
 .           require      *            postgres       connect, gssaccept, authok   -> gss
 .           .            require      direct         connect, gssaccept, authok   -> gss
 
-# sslnegotiation=direct is not acccepted unless sslmode=require or stronger
+# sslnegotiation=direct is not accepted unless sslmode=require or stronger
 *           *            disable      direct         -     -> fail
 *           *            allow        direct         -     -> fail
 *           *            prefer       direct         -     -> fail
-- 
2.45.2

---

From: Daniel Gustafsson <[email-masked]>
Date: Wed, 4 Sep 2024 10:23:44 +0200

> On 4 Sep 2024, at 03:25, Michael Paquier <[email-masked]> wrote:
> 

Not mandatory at all, but since you were prepping a typo backpatch anyways I
figured these could join to put a small dent in reducing risks for future
backports.

--
Daniel Gustafsson

---

From: David Rowley <[email-masked]>
Date: Thu, 5 Sep 2024 03:34:31 +1200

> figured these could join to put a small dent in reducing risks for future

I think this is pretty good logic.  I think fixing comment typos in
ancient code and backpatching to all supported versions isn't good use
of time, but fixing a typo in "recent" code and backpatching to where
that code was added seems useful. Newer code is more likely to need
bug fixes in the future, so going to a bit more effort to make
backpatching those bug fixes easier seems worth the effort.  I just
don't know what "recent" should be defined as. I'd say if it's in a
version we've not released yet, that's probably recent. By the time .1
is out, there's less chance of bugs in new code. Anyway, I doubt hard
guidelines are warranted here, but maybe some hints about best
practices in https://wiki.postgresql.org/wiki/Committing_checklist ?

David

---

From: Michael Paquier <[email-masked]>
Date: Thu, 5 Sep 2024 09:03:26 +0900

On Thu, Sep 05, 2024 at 03:34:31AM +1200, David Rowley wrote:
> Anyway, I doubt hard

Yep, that may be useful.  I just tend to be cautious because it can be
very easy to mess up things depending on the code path you're
manipulating, speaking with some..  Experience on the matter.  And an
RC1 is kind of something to be cautious with.
--
Michael

---

From: Alexander Lakhin <[email-masked]>
Date: Wed, 1 Jan 2025 18:00:01 +0200

Hello hackers,

> And done that.

Please look at another collection of typos and inconsistencies introduced
during 2024:
behvior -> behavior

contraint -> constraint

curent -> current

disable_node -> disabled_nodes

disabled_node > disabled_nodes

disable_nodes -> disabled_nodes

FindFkPeriodOpers -> FindFKPeriodOpers

heap_inplace_update -> heap_inplace_update_and_unlock

InitLocks -> LockManagerShmemInit? (see fbce7dfc7)

isReadOnly -> IsReadOnly

negotations -> negotiations

notnull_inh -> notnull_islocal (coined by 14e87ffa5)

num_word -> just remove an old-fashioned comment? or change to
  append_num_word (see 5bf948d56)

objectAddress -> ObjectAddress

orderProc -> orderProcs

pg_visibilitymap.c -> visibilitymap.c

postitional_fcinfo -> positional_fcinfo

preserve_formatting -> preserve_comments (see 995e0fbc1)

procesess -> processes

trapper -> trapped

trasformed -> transformed

vac_update_datfrozenid -> vac_update_datfrozenxid

XLPH_HAS_* -> XLHP_HAS_*

XLogRecordInsert -> XLogInsertRecord (coined by afd12774a)

Please find attached the corresponding patch for your convenience.

Best regards,
Alexander

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 329e727f80..b2dd146677 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6387,7 +6387,7 @@ heap_inplace_update_and_unlock(Relation relation,
 	 *
 	 * ["D" is a VACUUM (ONLY_DATABASE_STATS)]
 	 * ["R" is a VACUUM tbl]
-	 * D: vac_update_datfrozenid() -> systable_beginscan(pg_class)
+	 * D: vac_update_datfrozenxid() -> systable_beginscan(pg_class)
 	 * D: systable_getnext() returns pg_class tuple of tbl
 	 * R: memcpy() into pg_class tuple of tbl
 	 * D: raise pg_database.datfrozenxid, XLogInsert(), finish
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index 11c9532719..a87145aeeb 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -2133,7 +2133,7 @@ log_heap_prune_and_freeze(Relation relation, Buffer buffer,
 							sizeof(OffsetNumber) * nfrozen);
 
 	/*
-	 * Prepare the main xl_heap_prune record.  We already set the XLPH_HAS_*
+	 * Prepare the main xl_heap_prune record.  We already set the XLHP_HAS_*
 	 * flag above.
 	 */
 	if (RelationIsAccessibleInLogicalDecoding(relation))
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index a531d37908..593cd98d70 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -2584,7 +2584,7 @@ _bt_preprocess_keys(IndexScanDesc scan)
 	{
 		inkeys = arrayKeyData;
 
-		/* Also maintain keyDataMap for remapping so->orderProc[] later */
+		/* Also maintain keyDataMap for remapping so->orderProcs[] later */
 		keyDataMap = MemoryContextAlloc(so->arrayContext,
 										numberOfKeys * sizeof(int));
 	}
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 6f58412bca..b5ff45602a 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -554,7 +554,7 @@ typedef struct XLogCtlData
 } XLogCtlData;
 
 /*
- * Classification of XLogRecordInsert operations.
+ * Classification of XLogInsertRecord operations.
  */
 typedef enum
 {
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c
index 9c05a98d28..e210886e17 100644
--- a/src/backend/catalog/pg_constraint.c
+++ b/src/backend/catalog/pg_constraint.c
@@ -1600,7 +1600,7 @@ DeconstructFkConstraintRow(HeapTuple tuple, int *numfks,
 }
 
 /*
- * FindFkPeriodOpers -
+ * FindFKPeriodOpers -
  *
  * Looks up the operator oids used for the PERIOD part of a temporal foreign key.
  * The opclass should be the opclass of that PERIOD element.
diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c
index 2b4514e8a3..3ed45f3cfc 100644
--- a/src/backend/catalog/pg_depend.c
+++ b/src/backend/catalog/pg_depend.c
@@ -35,7 +35,7 @@ static bool isObjectPinned(const ObjectAddress *object);

 /*
- * Record a dependency between 2 objects via their respective objectAddress.
+ * Record a dependency between 2 objects via their respective ObjectAddress.
  * The first argument is the dependent object, the second the one it
  * references.
  *
diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c
index 5b22cf1099..20d9a21abc 100644
--- a/src/backend/catalog/storage.c
+++ b/src/backend/catalog/storage.c
@@ -380,7 +380,7 @@ RelationTruncate(Relation rel, BlockNumber nblocks)
 	 * replay or visibility invariants downstream.  The critical section also
 	 * suppresses interrupts.
 	 *
-	 * (See also pg_visibilitymap.c if changing this code.)
+	 * (See also visibilitymap.c if changing this code.)
 	 */
 	START_CRIT_SECTION();
 
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index a201ed3082..c1e1e9804d 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -1384,8 +1384,8 @@ ExplainPreScanNode(PlanState *planstate, Bitmapset **rels_used)
 /*
  * plan_is_disabled
  *		Checks if the given plan node type was disabled during query planning.
- *		This is evident by the disable_node field being higher than the sum of
- *		the disabled_node field from the plan's children.
+ *		This is evident by the disabled_nodes field being higher than the sum of
+ *		the disabled_nodes field from the plan's children.
  */
 static bool
 plan_is_disabled(Plan *plan)
@@ -1462,7 +1462,7 @@ plan_is_disabled(Plan *plan)
 	}
 
 	/*
-	 * It's disabled if the plan's disable_nodes is higher than the sum of its
+	 * It's disabled if the plan's disabled_nodes is higher than the sum of its
 	 * child's plan disabled_nodes.
 	 */
 	if (plan->disabled_nodes > child_disabled_nodes)
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 5d102a0d37..87ce46d3b4 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -2620,7 +2620,7 @@ match_clause_to_index(PlannerInfo *root,
  *
  *	  It is also possible to match a list of OR clauses if it might be
  *	  transformed into a single ScalarArrayOpExpr clause.  On success,
- *	  the returning index clause will contain a trasformed clause.
+ *	  the returning index clause will contain a transformed clause.
  *
  *	  For boolean indexes, it is also possible to match the clause directly
  *	  to the indexkey; or perhaps the clause is (NOT indexkey).
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 6f849ffbcb..161020f289 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2827,7 +2827,7 @@ PostmasterStateMachine(void)
 
 	/*
 	 * In the PM_WAIT_BACKENDS state, wait for all the regular backends and
-	 * procesess like autovacuum and background workers that are comparable to
+	 * processes like autovacuum and background workers that are comparable to
 	 * backends to exit.
 	 *
 	 * PM_STOP_BACKENDS is a transient state that means the same as
diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index e73576ad12..21828ac6cf 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -519,8 +519,8 @@ heap_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 			 * tuples, we're not interested in the record's contents.
 			 *
 			 * WAL contains likely-unnecessary commit-time invals from the
-			 * CacheInvalidateHeapTuple() call in heap_inplace_update().
-			 * Excess invalidation is safe.
+			 * CacheInvalidateHeapTuple() call in
+			 * heap_inplace_update_and_unlock(). Excess invalidation is safe.
 			 */
 			break;
 
diff --git a/src/backend/statistics/attribute_stats.c b/src/backend/statistics/attribute_stats.c
index b97ba7b0c0..21d6293a23 100644
--- a/src/backend/statistics/attribute_stats.c
+++ b/src/backend/statistics/attribute_stats.c
@@ -538,7 +538,7 @@ get_attr_stat_type(Oid reloid, AttrNumber attnum, int elevel,
 	 * When analyzing an expression index, believe the expression tree's type
 	 * not the column datatype --- the latter might be the opckeytype storage
 	 * type of the opclass, which is not interesting for our purposes. This
-	 * mimics the behvior of examine_attribute().
+	 * mimics the behavior of examine_attribute().
 	 */
 	if (expr == NULL)
 	{
diff --git a/src/backend/statistics/stat_utils.c b/src/backend/statistics/stat_utils.c
index 728e30e780..e874497df6 100644
--- a/src/backend/statistics/stat_utils.c
+++ b/src/backend/statistics/stat_utils.c
@@ -243,7 +243,7 @@ stats_fill_fcinfo_from_arg_pairs(FunctionCallInfo pairs_fcinfo,
 	/*
 	 * For each argument name/value pair, find corresponding positional
 	 * argument for the argument name, and assign the argument value to
-	 * postitional_fcinfo.
+	 * positional_fcinfo.
 	 */
 	for (int i = 0; i < nargs; i += 2)
 	{
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 0576bb75b2..f549ba5be1 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -21,7 +21,7 @@
  *
  *	Interface:
  *
- *	InitLocks(), GetLocksMethodTable(), GetLockTagsMethodTable(),
+ *	LockManagerShmemInit(), GetLocksMethodTable(), GetLockTagsMethodTable(),
  *	LockAcquire(), LockRelease(), LockReleaseAll(),
  *	LockCheckConflicts(), GrantLock()
  *
diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c
index c1a743b2a6..611d23f3cb 100644
--- a/src/backend/utils/adt/cash.c
+++ b/src/backend/utils/adt/cash.c
@@ -85,7 +85,7 @@ append_num_word(StringInfo buf, Cash value)
 		else
 			appendStringInfo(buf, "%s %s", big[tu / 10], small[tu % 10]);
 	}
-}								/* num_word() */
+}
 
 static inline Cash
 cash_pl_cash(Cash c1, Cash c2)
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 19969e400f..167b2bd33e 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -9347,8 +9347,8 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
  * constraints and the columns in the child don't have their own NOT NULL
  * declarations, we suppress printing constraints in the child: the
  * constraints are acquired at the point where the child is attached to the
- * parent.  This is tracked in ->notnull_inh (which is set in flagInhAttrs for
- * servers pre-18).
+ * parent.  This is tracked in ->notnull_islocal (which is set in flagInhAttrs
+ * for servers pre-18).
  *
  * Any of these constraints might have the NO INHERIT bit.  If so we set
  * ->notnull_noinh and NO INHERIT will be printed by dumpTableSchema.
@@ -16513,7 +16513,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
 				 * conislocal.  The inhcount is fixed by ALTER TABLE INHERIT,
 				 * below.  Special hack: in versions < 18, columns with no
 				 * local definition need their constraint to be matched by
-				 * column number in conkeys instead of by contraint name,
+				 * column number in conkeys instead of by constraint name,
 				 * because the latter is not available.  (We distinguish the
 				 * case because the constraint name is the empty string.)
 				 */
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index 242326c97a..5cc1ecb6f1 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -227,7 +227,7 @@ findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, int tliIndex,
 
 			snprintf(xlogfname, MAXFNAMELEN, XLOGDIR "/");
 
-			/* update curent values */
+			/* update current values */
 			current_tli = xlogreader->seg.ws_tli;
 			current_segno = xlogreader->seg.ws_segno;
 
diff --git a/src/include/catalog/reformat_dat_file.pl b/src/include/catalog/reformat_dat_file.pl
index 838cd0af73..1cd0464229 100755
--- a/src/include/catalog/reformat_dat_file.pl
+++ b/src/include/catalog/reformat_dat_file.pl
@@ -84,7 +84,7 @@ foreach my $datfile (@ARGV)
 # if you need to. In the following example, the "next if !ref $row"
 # check below is a hack to filter out non-hash objects. This is because
 # we build the lookup tables from data that we read using the
-# "preserve_formatting" parameter.
+# "preserve_comments" parameter.
 #
 ##Index access method lookup.
 #my %amnames;
diff --git a/src/include/commands/copyfrom_internal.h b/src/include/commands/copyfrom_internal.h
index cad52fcc78..1de843ca8e 100644
--- a/src/include/commands/copyfrom_internal.h
+++ b/src/include/commands/copyfrom_internal.h
@@ -95,7 +95,7 @@ typedef struct CopyFromStateData
 								 * default value */
 	FmgrInfo   *in_functions;	/* array of input functions for each attrs */
 	Oid		   *typioparams;	/* array of element types for in_functions */
-	ErrorSaveContext *escontext;	/* soft error trapper during in_functions
+	ErrorSaveContext *escontext;	/* soft error trapped during in_functions
 									 * execution */
 	uint64		num_errors;		/* total number of rows which contained soft
 								 * errors */
diff --git a/src/include/jit/SectionMemoryManager.h b/src/include/jit/SectionMemoryManager.h
index 93cf977157..69e4d66e5e 100644
--- a/src/include/jit/SectionMemoryManager.h
+++ b/src/include/jit/SectionMemoryManager.h
@@ -153,7 +153,7 @@ public:
   /// a default alignment of 16 will be used.
   uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
                                unsigned SectionID, StringRef SectionName,
-                               bool isReadOnly) override;
+                               bool IsReadOnly) override;
 
   /// Update section-specific memory permissions and other attributes.
   ///
diff --git a/src/test/postmaster/t/002_start_stop.pl b/src/test/postmaster/t/002_start_stop.pl
index 993d855ece..ad11db159e 100644
--- a/src/test/postmaster/t/002_start_stop.pl
+++ b/src/test/postmaster/t/002_start_stop.pl
@@ -54,7 +54,7 @@ for (my $i = 0; $i <= 20; $i++)
 	# postmaster cannot accept() them fast enough. The exact limit
 	# and behavior depends on the platform. To make this reliable,
 	# we attempt SSL negotiation on each connection before opening
-	# next one. The server will reject the SSL negotations, but
+	# next one. The server will reject the SSL negotiations, but
 	# when it does so, we know that the backend has been launched
 	# and we should be able to open another connection.

---

From: David Rowley <[email-masked]>
Date: Thu, 2 Jan 2025 12:22:35 +1300

> Please look at another collection of typos and inconsistencies introduced

The fixes all look good to me. I see some are mine, so I will take
care of pushing.

Thanks for the patch.

David

---

From: Alexander Lakhin <[email-masked]>
Date: Sat, 19 Apr 2025 11:00:00 +0300

Hello hackers,

I've gathered the following collection of typos and inconsistencies
appeared since 2025-01-01:
aio_worker.c -> method_worker.c

amcheck_lock_relation -> amcheck_lock_relation_and_check

be_key -> be_cancel_key

belonds -> belongs

cann -> can

CheckConstraintFetch -> CheckNNConstraintFetch
(renamed by a379061a2)

COLLID -> COLLOID

coltypemods -> coltypmods

columsn -> column

combinig -> combining

containting -> containing

non-exist datbase -> non-existent database

dead_end -> dead-end
(see a78af0427)

derefefence -> dereference

displyed -> displayed

droping -> dropping

es_eqp_active -> es_epq_active

es_part_prune_result -> es_part_prune_results

ExceDelete -> ExecDelete

excludes-chema -> exclude-schema

it fhe -> if the

GIN_TUPLE_ -> GIN_TUPLE_H

HandleFatalErrors -> HandleFatalError

happend -> reached
(to preserve the line width)

happenning -> happening

HIKEY -> P_HIKEY

IGNORE_CHECKSUM_FAILURE -> PIV_IGNORE_CHECKSUM_FAILURE

InitExecPartitionPruneContext -> InitExecPartitionPruneContexts

inititalization -> initialization

Injection_point -> Injection point

iterm -> item

$log_end -> remove unused variable
(align with src/test/modules/oauth_validator/t/001_server.pl)

looplback -> loopback

mappping -> mapping

MyWorkerId -> MyIoWorkerId

negotation -> negotiation

network-byte-order -> network byte order

parititioned* -> partitioned*

pending_null -> pending_nulls

permanentaly -> permanently

pg_localeconf_free -> pg_localeconv_free

PG_READ_ALL_STATS -> ROLE_PG_READ_ALL_STATS

pk_strategy -> pk_cmptype
(see 8123e91f5)

PM_WAIT_BACKEND -> PM_WAIT_BACKENDS

pollset -> poll set

predicable -> predictable

PRINT_STATS_STDERR -> PRINT_STATS_TO_STDERR

procced -> proceed

remining -> remaining

save_xmin -> saved_xmin

smgstartreadv -> smgrstartreadv

StartLocalBufer -> StartLocalBufferIO

statitistics -> statistics

swaping -> swapping

synq_queue_destroy -> sync_queue_destroy

thats -> that's

ther -> there

test-server -> test server

unfronzen -> unfrozen

upin -> unpin

Please find attached the complete patch for your convenience.

Best regards,
Alexander Lakhin
Neon (https://neon.tech)

diff --git a/contrib/amcheck/verify_common.h b/contrib/amcheck/verify_common.h
index b2565bfbbab..e78adb68808 100644
--- a/contrib/amcheck/verify_common.h
+++ b/contrib/amcheck/verify_common.h
@@ -16,7 +16,7 @@
 #include "utils/relcache.h"
 #include "miscadmin.h"
 
-/* Typedefs for callback functions for amcheck_lock_relation */
+/* Typedefs for callback functions for amcheck_lock_relation_and_check */
 typedef void (*IndexCheckableCallback) (Relation index);
 typedef void (*IndexDoCheckCallback) (Relation rel,
 									  Relation heaprel,
diff --git a/contrib/amcheck/verify_gin.c b/contrib/amcheck/verify_gin.c
index 318fe330518..3629243ed01 100644
--- a/contrib/amcheck/verify_gin.c
+++ b/contrib/amcheck/verify_gin.c
@@ -359,7 +359,7 @@ gin_check_posting_tree_parent_keys_consistency(Relation rel, BlockNumber posting
 				ptr->depth = stack->depth + 1;
 
 				/*
-				 * Set rightmost parent key to invalid iterm pointer. Its
+				 * Set rightmost parent key to invalid item pointer. Its
 				 * value is 'Infinity' and not explicitly stored.
 				 */
 				if (rightlink == InvalidBlockNumber)
@@ -587,7 +587,7 @@ gin_check_parent_keys_consistency(Relation rel,
 
 						/*
 						 * Check if it is properly adjusted. If succeed,
-						 * procced to the next key.
+						 * proceed to the next key.
 						 */
 						if (ginCompareEntries(&state, attnum, current_key,
 											  current_key_category, parent_key,
diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c
index e1701bd56ef..6bfb9fb669e 100644
--- a/contrib/pg_buffercache/pg_buffercache_pages.c
+++ b/contrib/pg_buffercache/pg_buffercache_pages.c
@@ -289,7 +289,7 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
  *
  * Returns NUMA node ID for each memory page used by the buffer. Buffers may
  * be smaller or larger than OS memory pages. For each buffer we return one
- * entry for each memory page used by the buffer (it fhe buffer is smaller,
+ * entry for each memory page used by the buffer (if the buffer is smaller,
  * it only uses a part of one memory page).
  *
  * We expect both sizes (for buffers and memory pages) to be a power-of-2, so
@@ -335,7 +335,7 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS)
 		 * how the pages and buffers "align" in memory - the buffers may be
 		 * shifted in some way, using more memory pages than necessary.
 		 *
-		 * So we need to be careful about mappping buffers to memory pages. We
+		 * So we need to be careful about mapping buffers to memory pages. We
 		 * calculate the maximum number of pages a buffer might use, so that
 		 * we allocate enough space for the entries. And then we count the
 		 * actual number of entries as we scan the buffers.
diff --git a/contrib/pg_overexplain/expected/pg_overexplain.out b/contrib/pg_overexplain/expected/pg_overexplain.out
index 28252dbff6c..44120c388af 100644
--- a/contrib/pg_overexplain/expected/pg_overexplain.out
+++ b/contrib/pg_overexplain/expected/pg_overexplain.out
@@ -123,7 +123,7 @@ $$);
  RTI 1 (relation, inherited, in-from-clause):
    Eref: vegetables (id, name, genus)
    Relation: vegetables
-   Relation Kind: parititioned_table
+   Relation Kind: partitioned_table
    Relation Lock Mode: AccessShareLock
    Permission Info Index: 1
  RTI 2 (group):
@@ -250,7 +250,7 @@ $$);
          <In-From-Clause>true</In-From-Clause>                      +
          <Eref>vegetables (id, name, genus)</Eref>                  +
          <Relation>vegetables</Relation>                            +
-         <Relation-Kind>parititioned_table</Relation-Kind>          +
+         <Relation-Kind>partitioned_table</Relation-Kind>           +
          <Relation-Lock-Mode>AccessShareLock</Relation-Lock-Mode>   +
          <Permission-Info-Index>1</Permission-Info-Index>           +
          <Security-Barrier>false</Security-Barrier>                 +
@@ -454,7 +454,7 @@ SELECT * FROM vegetables WHERE genus = 'daucus';
  RTI 1 (relation, inherited, in-from-clause):
    Eref: vegetables (id, name, genus)
    Relation: vegetables
-   Relation Kind: parititioned_table
+   Relation Kind: partitioned_table
    Relation Lock Mode: AccessShareLock
    Permission Info Index: 1
  RTI 2 (relation, in-from-clause):
@@ -478,7 +478,7 @@ INSERT INTO vegetables (name, genus) VALUES ('broccoflower', 'brassica');
  RTI 1 (relation):
    Eref: vegetables (id, name, genus)
    Relation: vegetables
-   Relation Kind: parititioned_table
+   Relation Kind: partitioned_table
    Relation Lock Mode: RowExclusiveLock
    Permission Info Index: 1
  RTI 2 (result):
diff --git a/contrib/pg_overexplain/pg_overexplain.c b/contrib/pg_overexplain/pg_overexplain.c
index f60049f4ba6..de824566f8c 100644
--- a/contrib/pg_overexplain/pg_overexplain.c
+++ b/contrib/pg_overexplain/pg_overexplain.c
@@ -277,7 +277,7 @@ overexplain_per_plan_hook(PlannedStmt *plannedstmt,
  * Print out various details from the PlannedStmt that wouldn't otherwise
  * be displayed.
  *
- * We don't try to print everything here. Information that would be displyed
+ * We don't try to print everything here. Information that would be displayed
  * anyway doesn't need to be printed again here, and things with lots of
  * substructure probably should be printed via separate options, or not at all.
  */
@@ -517,10 +517,10 @@ overexplain_range_table(PlannedStmt *plannedstmt, ExplainState *es)
 				relkind = "foreign_table";
 				break;
 			case RELKIND_PARTITIONED_TABLE:
-				relkind = "parititioned_table";
+				relkind = "partitioned_table";
 				break;
 			case RELKIND_PARTITIONED_INDEX:
-				relkind = "parititioned_index";
+				relkind = "partitioned_index";
 				break;
 			case '\0':
 				relkind = NULL;
@@ -632,7 +632,7 @@ overexplain_range_table(PlannedStmt *plannedstmt, ExplainState *es)
 		}
 
 		/*
-		 * add_rte_to_flat_rtable will clear coltypes, coltypemods, and
+		 * add_rte_to_flat_rtable will clear coltypes, coltypmods, and
 		 * colcollations, so skip those fields.
 		 *
 		 * If this is an ephemeral named relation, print out ENR-related
@@ -675,7 +675,7 @@ overexplain_range_table(PlannedStmt *plannedstmt, ExplainState *es)
  * Emit a text property describing the contents of an Alias.
  *
  * Column lists can be quite long here, so perhaps we should have an option
- * to limit the display length by # of columsn or # of characters, but for
+ * to limit the display length by # of column or # of characters, but for
  * now, just display everything.
  */
 static void
diff --git a/contrib/postgres_fdw/t/001_auth_scram.pl b/contrib/postgres_fdw/t/001_auth_scram.pl
index ba178246eb7..b94a6a6293b 100644
--- a/contrib/postgres_fdw/t/001_auth_scram.pl
+++ b/contrib/postgres_fdw/t/001_auth_scram.pl
@@ -3,7 +3,7 @@
 # Test SCRAM authentication when opening a new connection with a foreign
 # server.
 #
-# The test is executed by testing the SCRAM authentifcation on a looplback
+# The test is executed by testing the SCRAM authentifcation on a loopback
 # connection on the same server and with different servers.
 
 use strict;
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index bfc1e7b3524..b757d27ebd0 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1315,7 +1315,7 @@ PostgreSQL documentation
          </para>
          <para>
           The data section contains actual table data, large-object
-          contents, statitistics for tables and materialized views and
+          contents, statistics for tables and materialized views and
           sequence values.
           Post-data items include definitions of indexes, triggers, rules,
           statistics for indexes, and constraints other than validated check
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 0e5e8e8f309..bf4ffb30576 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -353,7 +353,7 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
      <listitem>
       <para>
        Runs the test suite under <filename>src/test/modules/oauth_validator</filename>.
-       This opens TCP/IP listen sockets for a test-server running HTTPS.
+       This opens TCP/IP listen sockets for a test server running HTTPS.
       </para>
      </listitem>
     </varlistentry>
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index cfab93ec30c..a7b7b5996e3 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -167,7 +167,7 @@ typedef struct
 
 	/*
 	 * The sortstate used only within a single worker for the first merge pass
-	 * happenning there. In principle it doesn't need to be part of the build
+	 * happening there. In principle it doesn't need to be part of the build
 	 * state and we could pass it around directly, but it's more convenient
 	 * this way. And it's part of the build state, after all.
 	 */
@@ -1306,7 +1306,7 @@ GinBufferIsEmpty(GinBuffer *buffer)
  * Compare if the tuple matches the already accumulated data in the GIN
  * buffer. Compare scalar fields first, before the actual key.
  *
- * Returns true if the key matches, and the TID belonds to the buffer, or
+ * Returns true if the key matches, and the TID belongs to the buffer, or
  * false if the key does not match.
  */
 static bool
@@ -1497,7 +1497,7 @@ GinBufferStoreTuple(GinBuffer *buffer, GinTuple *tup)
 			buffer->items = repalloc(buffer->items,
 									 (buffer->nitems + tup->nitems) * sizeof(ItemPointerData));
 
-		new = ginMergeItemPointers(&buffer->items[buffer->nfrozen], /* first unfronzen */
+		new = ginMergeItemPointers(&buffer->items[buffer->nfrozen], /* first unfrozen */
 								   (buffer->nitems - buffer->nfrozen),	/* num of unfrozen */
 								   items, tup->nitems, &nnew);
 
@@ -1531,7 +1531,7 @@ GinBufferReset(GinBuffer *buffer)
 		pfree(DatumGetPointer(buffer->key));
 
 	/*
-	 * Not required, but makes it more likely to trigger NULL derefefence if
+	 * Not required, but makes it more likely to trigger NULL dereference if
 	 * using the value incorrectly, etc.
 	 */
 	buffer->key = (Datum) 0;
@@ -1603,7 +1603,7 @@ GinBufferCanAddKey(GinBuffer *buffer, GinTuple *tup)
  *
  * After waiting for all workers to finish, merge the per-worker results into
  * the complete index. The results from each worker are sorted by block number
- * (start of the page range). While combinig the per-worker results we merge
+ * (start of the page range). While combining the per-worker results we merge
  * summaries for the same page range, and also fill-in empty summaries for
  * ranges without any tuples.
  *
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index f69397623df..77264ddeecb 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -1792,7 +1792,7 @@ _bt_readpage(IndexScanDesc scan, ScanDirection dir, OffsetNumber offnum,
 
 			truncatt = BTreeTupleGetNAtts(itup, rel);
 			pstate.forcenonrequired = false;
-			pstate.startikey = 0;	/* _bt_set_startikey ignores HIKEY */
+			pstate.startikey = 0;	/* _bt_set_startikey ignores P_HIKEY */
 			_bt_checkkeys(scan, &pstate, arrayKeys, itup, truncatt);
 		}
 
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index ec40c0b7c42..2d4c346473b 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -473,7 +473,7 @@ typedef struct XLogCtlData
 	XLogRecPtr	InitializedFrom;
 
 	/*
-	 * Latest reserved for inititalization page in the cache (last byte
+	 * Latest reserved for initialization page in the cache (last byte
 	 * position + 1).
 	 *
 	 * To change the identity of a buffer, you need to advance
@@ -2221,7 +2221,7 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, TimeLineID tli, bool opportunistic)
 		 *	  m must observe f[k] == false.  Otherwise, it will later attempt
 		 *	  CAS(v, k, k + 1) with success.
 		 * 4. Therefore, corresponding read_barrier() (while j == k) on
-		 *	  process m happend before write_barrier() of process k.  But then
+		 *	  process m reached before write_barrier() of process k.  But then
 		 *	  process k attempts CAS(v, k, k + 1) after process m successfully
 		 *	  incremented v to k, and that CAS operation must succeed.
 		 *	  That leads to a contradiction.  So, there is no such k (k < n)
@@ -2253,7 +2253,7 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, TimeLineID tli, bool opportunistic)
 			if (pg_atomic_read_u64(&XLogCtl->xlblocks[nextidx]) != NewPageEndPtr)
 			{
 				/*
-				 * Page at nextidx wasn't initialized yet, so we cann't move
+				 * Page at nextidx wasn't initialized yet, so we can't move
 				 * InitializedUpto further. It will be moved by backend which
 				 * will initialize nextidx.
 				 */
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index 35ebb0ccda4..60000bd0bc7 100644
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -143,7 +143,7 @@ IsCatalogRelationOid(Oid relid)
  *
  *		The relcache must not use these indexes.  Inserting into any UNIQUE
  *		index compares index keys while holding BUFFER_LOCK_EXCLUSIVE.
- *		bttextcmp() can search the COLLID catcache.  Depending on concurrent
+ *		bttextcmp() can search the COLLOID catcache.  Depending on concurrent
  *		invalidation traffic, catcache can reach relcache builds.  A backend
  *		would self-deadlock on LWLocks if the relcache build read the
  *		exclusive-locked buffer.
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 80f689bbbc5..265b1c397fb 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -11999,7 +11999,7 @@ DropForeignKeyConstraintTriggers(Relation trigrel, Oid conoid, Oid confrelid,
 		if (OidIsValid(confrelid) && trgform->tgrelid != confrelid)
 			continue;
 
-		/* We should be droping trigger related to foreign key constraint */
+		/* We should be dropping trigger related to foreign key constraint */
 		Assert(trgform->tgfoid == F_RI_FKEY_CHECK_INS ||
 			   trgform->tgfoid == F_RI_FKEY_CHECK_UPD ||
 			   trgform->tgfoid == F_RI_FKEY_CASCADE_DEL ||
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 2da848970be..7230f968101 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -1861,7 +1861,7 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
 	MemoryContext oldContext;
 
 	/*
-	 * CheckConstraintFetch let this pass with only a warning, but now we
+	 * CheckNNConstraintFetch let this pass with only a warning, but now we
 	 * should fail rather than possibly failing to enforce an important
 	 * constraint.
 	 */
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index 5a77c253826..9435cc21fe7 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -1778,7 +1778,7 @@ adjust_partition_colnos_using_map(List *colnos, AttrMap *attrMap)
  *		Updates the PartitionPruneState found at given part_prune_index in
  *		EState.es_part_prune_states for use during "exec" pruning if required.
  *		Also returns the set of subplans to initialize that would be stored at
- *		part_prune_index in EState.es_part_prune_result by
+ *		part_prune_index in EState.es_part_prune_results by
  *		ExecDoInitialPruning().  Maps in PartitionPruneState are updated to
  *		account for initial pruning possibly having eliminated some of the
  *		subplans.
@@ -2109,7 +2109,7 @@ CreatePartitionPruneState(EState *estate, PartitionPruneInfo *pruneinfo,
 			 */
 			partrel = ExecGetRangeTableRelation(estate, pinfo->rtindex, false);
 
-			/* Remember for InitExecPartitionPruneContext(). */
+			/* Remember for InitExecPartitionPruneContexts(). */
 			pprune->partrel = partrel;
 
 			partkey = RelationGetPartitionKey(partrel);
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 333cbf78343..46d533b7288 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -1311,7 +1311,7 @@ ExecInsert(ModifyTableContext *context,
 
 			/*
 			 * Convert the OLD tuple to the new partition's format/slot, if
-			 * needed.  Note that ExceDelete() already converted it to the
+			 * needed.  Note that ExecDelete() already converted it to the
 			 * root's partition's format/slot.
 			 */
 			oldSlot = context->cpDeletedSlot;
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c
index 6f9e991eeae..ed35c58c2c3 100644
--- a/src/backend/executor/nodeSeqscan.c
+++ b/src/backend/executor/nodeSeqscan.c
@@ -100,7 +100,7 @@ SeqRecheck(SeqScanState *node, TupleTableSlot *slot)
  *		ExecSeqScan(node)
  *
  *		Scans the relation sequentially and returns the next qualifying
- *		tuple. This variant is used when there is no es_eqp_active, no qual
+ *		tuple. This variant is used when there is no es_epq_active, no qual
  *		and no projection.  Passing const-NULLs for these to ExecScanExtended
  *		allows the compiler to eliminate the additional code that would
  *		ordinarily be required for the evaluation of these.
diff --git a/src/backend/nodes/queryjumblefuncs.c b/src/backend/nodes/queryjumblefuncs.c
index 27fb87d3aaa..d1e82a63f09 100644
--- a/src/backend/nodes/queryjumblefuncs.c
+++ b/src/backend/nodes/queryjumblefuncs.c
@@ -357,7 +357,7 @@ AppendJumble64(JumbleState *jstate, const unsigned char *value)
 
 /*
  * FlushPendingNulls
- *		Incorporate the pending_null value into the jumble buffer.
+ *		Incorporate the pending_nulls value into the jumble buffer.
  *
  * Note: Callers must ensure that there's at least 1 pending NULL.
  */
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 17fed96fe20..490f7ce3664 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2718,7 +2718,7 @@ HandleFatalError(QuitSignalReason reason, bool consider_sigabrt)
 	/*
 	 * Choose the appropriate new state to react to the fatal error. Unless we
 	 * were already in the process of shutting down, we go through
-	 * PM_WAIT_BACKEND. For errors during the shutdown sequence, we directly
+	 * PM_WAIT_BACKENDS. For errors during the shutdown sequence, we directly
 	 * switch to PM_WAIT_DEAD_END.
 	 */
 	switch (pmState)
@@ -3001,7 +3001,7 @@ PostmasterStateMachine(void)
 				/*
 				 * Stop any dead-end children and stop creating new ones.
 				 *
-				 * NB: Similar code exists in HandleFatalErrors(), when the
+				 * NB: Similar code exists in HandleFatalError(), when the
 				 * error happens in pmState > PM_WAIT_BACKENDS.
 				 */
 				UpdatePMState(PM_WAIT_DEAD_END);
@@ -3082,7 +3082,7 @@ PostmasterStateMachine(void)
 	{
 		/*
 		 * PM_WAIT_IO_WORKERS state ends when there's only checkpointer and
-		 * dead_end children left.
+		 * dead-end children left.
 		 */
 		if (io_worker_count == 0)
 		{
diff --git a/src/backend/storage/aio/README.md b/src/backend/storage/aio/README.md
index b00de269ad9..f10b5c7e31e 100644
--- a/src/backend/storage/aio/README.md
+++ b/src/backend/storage/aio/README.md
@@ -103,7 +103,7 @@ pgaio_io_set_handle_data_32(ioh, (uint32 *) buffer, 1);
  *
  * E.g. md.c needs to translate block numbers into offsets in segments.
  *
- * Once the IO handle has been handed off to smgstartreadv(), it may not
+ * Once the IO handle has been handed off to smgrstartreadv(), it may not
  * further be used, as the IO may immediately get executed below
  * smgrstartreadv() and the handle reused for another IO.
  *
diff --git a/src/backend/storage/aio/method_worker.c b/src/backend/storage/aio/method_worker.c
index 8ad17ec1ef7..5ff54f5c82c 100644
--- a/src/backend/storage/aio/method_worker.c
+++ b/src/backend/storage/aio/method_worker.c
@@ -321,7 +321,7 @@ pgaio_worker_die(int code, Datum arg)
 }
 
 /*
- * Register the worker in shared memory, assign MyWorkerId and register a
+ * Register the worker in shared memory, assign MyIoWorkerId and register a
  * shutdown callback to release registration.
  */
 static void
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 1f2a9fe9976..fe0ceeadc13 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -4970,7 +4970,7 @@ FlushRelationBuffers(Relation rel)
 				ResourceOwnerEnlarge(CurrentResourceOwner);
 
 				/*
-				 * Pin/upin mostly to make valgrind work, but it also seems
+				 * Pin/unpin mostly to make valgrind work, but it also seems
 				 * like the right thing to do.
 				 */
 				PinLocalBuffer(bufHdr, false);
diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c
index 82457bacc62..dbb49ed9197 100644
--- a/src/backend/storage/page/bufpage.c
+++ b/src/backend/storage/page/bufpage.c
@@ -88,7 +88,7 @@ PageInit(Page page, Size pageSize, Size specialSize)
  * To allow the caller to report statistics about checksum failures,
  * *checksum_failure_p can be passed in. Note that there may be checksum
  * failures even if this function returns true, due to
- * IGNORE_CHECKSUM_FAILURE.
+ * PIV_IGNORE_CHECKSUM_FAILURE.
  */
 bool
 PageIsVerified(PageData *page, BlockNumber blkno, int flags, bool *checksum_failure_p)
diff --git a/src/backend/utils/adt/mcxtfuncs.c b/src/backend/utils/adt/mcxtfuncs.c
index 254cdd34fba..206b601a52b 100644
--- a/src/backend/utils/adt/mcxtfuncs.c
+++ b/src/backend/utils/adt/mcxtfuncs.c
@@ -323,8 +323,8 @@ pg_log_backend_memory_contexts(PG_FUNCTION_ARGS)
  *		Signal a backend or an auxiliary process to send its memory contexts,
  *		wait for the results and display them.
  *
- * By default, only superusers or users with PG_READ_ALL_STATS are allowed to
- * signal a process to return the memory contexts. This is because allowing
+ * By default, only superusers or users with ROLE_PG_READ_ALL_STATS are allowed
+ * to signal a process to return the memory contexts. This is because allowing
  * any users to issue this request at an unbounded rate would cause lots of
  * requests to be sent, which can lead to denial of service. Additional roles
  * can be permitted with GRANT.
@@ -495,7 +495,7 @@ pg_get_process_memory_contexts(PG_FUNCTION_ARGS)
 			 * statistics are available within the allowed time then display
 			 * previously published statistics if there are any. If no
 			 * previous statistics are available then return NULL.  The timer
-			 * is defined in milliseconds since thats what the condition
+			 * is defined in milliseconds since that's what the condition
 			 * variable sleep uses.
 			 */
 			if (ConditionVariableTimedSleep(&memCxtState[procNumber].memcxt_cv,
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index a73aac4f98c..ab6317de5ae 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -19,7 +19,7 @@
  * immediately.
  *
  * The other categories, LC_MONETARY, LC_NUMERIC, and LC_TIME are
- * permanentaly set to "C", and then we use temporary locale_t
+ * permanently set to "C", and then we use temporary locale_t
  * objects when we need to look up locale data based on the GUCs
  * of the same name.  Information is cached when the GUCs change.
  * The cached information is only used by the formatting functions
diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c
index 3b681647060..9bcbc4c3e97 100644
--- a/src/backend/utils/cache/plancache.c
+++ b/src/backend/utils/cache/plancache.c
@@ -1271,7 +1271,7 @@ UpdateCachedPlan(CachedPlanSource *plansource, int query_index,
 	/*
 	 * XXX Should this also (re)set the properties of the CachedPlan that are
 	 * set in BuildCachedPlan() after creating the fresh plans such as
-	 * planRoleId, dependsOnRole, and save_xmin?
+	 * planRoleId, dependsOnRole, and saved_xmin?
 	 */
 
 	/*
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index e9aab36d110..468d0250b2e 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -910,7 +910,7 @@ MemoryContextStatsDetail(MemoryContext context,
  *
  * Print stats for this context if possible, but in any case accumulate counts
  * into *totals (if not NULL). The callers should make sure that print_location
- * is set to PRINT_STATS_STDERR or PRINT_STATS_TO_LOGS or PRINT_STATS_NONE.
+ * is set to PRINT_STATS_TO_STDERR or PRINT_STATS_TO_LOGS or PRINT_STATS_NONE.
  */
 static void
 MemoryContextStatsInternal(MemoryContext context, int level,
diff --git a/src/bin/pg_dump/t/006_pg_dumpall.pl b/src/bin/pg_dump/t/006_pg_dumpall.pl
index d6821c5615f..5acd49f1559 100644
--- a/src/bin/pg_dump/t/006_pg_dumpall.pl
+++ b/src/bin/pg_dump/t/006_pg_dumpall.pl
@@ -384,7 +384,7 @@ $node->command_fails_like(
 		'--format' => 'custom',
 		'-d' => 'dbpq', ],
 	qr/\Qpg_restore: error: could not connect to database "dbpq"\E/,
-	'When non-exist datbase is given with -d option in pg_restore with dump of pg_dumpall');
+	'When non-existent database is given with -d option in pg_restore with dump of pg_dumpall');
 
 $node->stop('fast');
 
diff --git a/src/bin/pg_upgrade/relfilenumber.c b/src/bin/pg_upgrade/relfilenumber.c
index aa205aec51d..79bc474a0bb 100644
--- a/src/bin/pg_upgrade/relfilenumber.c
+++ b/src/bin/pg_upgrade/relfilenumber.c
@@ -36,7 +36,7 @@ static void transfer_relfile(FileNameMap *map, const char *type_suffix, bool vm_
  *
  *     // be sure to sync any remaining files in the queue
  *     sync_queue_sync_all();
- *     synq_queue_destroy();
+ *     sync_queue_destroy();
  */
 
 #define SYNC_QUEUE_MAX_LEN	(1024)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 78fab48349b..7d82593879d 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -72,7 +72,7 @@ sub filter_dump
 # adjust_child_columns is passed to adjust_regress_dumpfile() which actually
 # adjusts the dump output.
 #
-# The name of the file containting adjusted dump is returned.
+# The name of the file containing adjusted dump is returned.
 sub get_dump_for_comparison
 {
 	my ($node, $db, $file_prefix, $adjust_child_columns) = @_;
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 5382a07b74d..21d660a8961 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -1459,7 +1459,7 @@ DescribeQuery(const char *query, double *elapsed_msec)
  *
  * If a synchronisation point is found, we can stop discarding results as
  * the pipeline will switch back to a clean state.  If no synchronisation
- * point is available, we need to stop when ther are no more pending
+ * point is available, we need to stop when there are no more pending
  * results, otherwise, calling PQgetResult() would block.
  */
 static PGresult *
diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl
index bb56b353492..75ac24a7a55 100644
--- a/src/bin/scripts/t/100_vacuumdb.pl
+++ b/src/bin/scripts/t/100_vacuumdb.pl
@@ -197,7 +197,7 @@ $node->command_fails_like(
 		'postgres',
 	],
 	qr/cannot vacuum specific table\(s\) and exclude schema\(s\) at the same time/,
-	'cannot use options --excludes-chema and ---table at the same time');
+	'cannot use options --exclude-schema and ---table at the same time');
 $node->command_fails_like(
 	[
 		'vacuumdb',
diff --git a/src/include/access/gin_tuple.h b/src/include/access/gin_tuple.h
index ce555031335..4a50565960f 100644
--- a/src/include/access/gin_tuple.h
+++ b/src/include/access/gin_tuple.h
@@ -7,8 +7,8 @@
  *	src/include/access/gin.h
  *--------------------------------------------------------------------------
  */
-#ifndef GIN_TUPLE_
-#define GIN_TUPLE_
+#ifndef GIN_TUPLE_H
+#define GIN_TUPLE_H
 
 #include "access/ginblock.h"
 #include "storage/itemptr.h"
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index bb678bdcdcd..011e5a811c3 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -1592,7 +1592,7 @@ typedef struct
  * equivalent and closely-related orderings. (See optimizer/README for more
  * information.)
  *
- * Note: pk_strategy is either COMPARE_LT (for ASC) or COMPARE_GT (for DESC).
+ * Note: pk_cmptype is either COMPARE_LT (for ASC) or COMPARE_GT (for DESC).
  */
 typedef struct PathKey
 {
diff --git a/src/include/storage/aio_subsys.h b/src/include/storage/aio_subsys.h
index 8a8ce87f62a..0cf36bb35da 100644
--- a/src/include/storage/aio_subsys.h
+++ b/src/include/storage/aio_subsys.h
@@ -31,7 +31,7 @@ extern void pgaio_error_cleanup(void);
 extern void AtEOXact_Aio(bool is_commit);

-/* aio_worker.c */
+/* method_worker.c */
 extern bool pgaio_workers_enabled(void);
 
 #endif							/* AIO_SUBSYS_H */
diff --git a/src/interfaces/libpq/fe-auth-oauth-curl.c b/src/interfaces/libpq/fe-auth-oauth-curl.c
index ddd87dcf02d..c195e00cd28 100644
--- a/src/interfaces/libpq/fe-auth-oauth-curl.c
+++ b/src/interfaces/libpq/fe-auth-oauth-curl.c
@@ -1205,7 +1205,7 @@ register_socket(CURL *curl, curl_socket_t socket, int what, void *ctx,
 	res = epoll_ctl(actx->mux, op, socket, &ev);
 	if (res < 0 && errno == EEXIST)
 	{
-		/* We already had this socket in the pollset. */
+		/* We already had this socket in the poll set. */
 		op = EPOLL_CTL_MOD;
 		res = epoll_ctl(actx->mux, op, socket, &ev);
 	}
diff --git a/src/interfaces/libpq/fe-cancel.c b/src/interfaces/libpq/fe-cancel.c
index e84e64bf2a7..25de2a337c9 100644
--- a/src/interfaces/libpq/fe-cancel.c
+++ b/src/interfaces/libpq/fe-cancel.c
@@ -50,7 +50,7 @@ struct pg_cancel
 									 * retransmits */
 
 	/* Pre-constructed cancel request packet starts here */
-	int32		cancel_pkt_len; /* in network-byte-order */
+	int32		cancel_pkt_len; /* in network byte order */
 	char		cancel_req[FLEXIBLE_ARRAY_MEMBER];	/* CancelRequestPacket */
 };
 
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index bd86de53c67..e08b344276f 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -693,7 +693,7 @@ pqDropServerData(PGconn *conn)
 	conn->oauth_want_retry = false;
 
 	/*
-	 * Cancel connections need to retain their be_pid and be_key across
+	 * Cancel connections need to retain their be_pid and be_cancel_key across
 	 * PQcancelReset invocations, otherwise they would not have access to the
 	 * secret token of the connection they are supposed to cancel.
 	 */
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index d85910f41fc..ca19e654a1c 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -1486,7 +1486,7 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
 	return 0;
 
 eof:
-	libpq_append_conn_error(conn, "received invalid protocol negotation message: message too short");
+	libpq_append_conn_error(conn, "received invalid protocol negotiation message: message too short");
 failure:
 	conn->asyncStatus = PGASYNC_READY;
 	pqSaveErrorResult(conn);
diff --git a/src/port/pg_localeconv_r.c b/src/port/pg_localeconv_r.c
index 938b4f82e12..4554ab84e9b 100644
--- a/src/port/pg_localeconv_r.c
+++ b/src/port/pg_localeconv_r.c
@@ -216,7 +216,7 @@ pg_localeconv_copy_members(struct lconv *dst,
  * implied by the LC_MONETARY or LC_NUMERIC locale name.  On Windows, LC_CTYPE
  * has to match to get sane results.
  *
- * To get predicable results on all platforms, we'll call the underlying
+ * To get predictable results on all platforms, we'll call the underlying
  * routines with LC_ALL set to the appropriate locale for each set of members,
  * and merge the results.  Three members of the resulting object are therefore
  * guaranteed to be encoded with LC_NUMERIC's codeset: "decimal_point",
@@ -224,7 +224,7 @@ pg_localeconv_copy_members(struct lconv *dst,
  * LC_MONETARY's codeset.
  *
  * Returns 0 on success.  Returns non-zero on failure, and sets errno.  On
- * success, the caller is responsible for calling pg_localeconf_free() on the
+ * success, the caller is responsible for calling pg_localeconv_free() on the
  * output struct to free the string members it contains.
  */
 int
diff --git a/src/port/pg_popcount_aarch64.c b/src/port/pg_popcount_aarch64.c
index bed0f7ab242..e515e4d45b8 100644
--- a/src/port/pg_popcount_aarch64.c
+++ b/src/port/pg_popcount_aarch64.c
@@ -457,7 +457,7 @@ pg_popcount_masked_neon(const char *buf, int bytes, bits8 mask)
 	popcnt += vaddvq_u64(vaddq_u64(accum3, accum4));
 
 	/*
-	 * Process remining 8-byte blocks.
+	 * Process remaining 8-byte blocks.
 	 */
 	for (; bytes >= sizeof(uint64); bytes -= sizeof(uint64))
 	{
diff --git a/src/test/modules/oauth_validator/t/002_client.pl b/src/test/modules/oauth_validator/t/002_client.pl
index 54769f12f57..8dd502f41e1 100644
--- a/src/test/modules/oauth_validator/t/002_client.pl
+++ b/src/test/modules/oauth_validator/t/002_client.pl
@@ -47,8 +47,7 @@ local all test oauth issuer="$issuer" scope="$scope"
 });
 $node->reload;
 
-my ($log_start, $log_end);
-$log_start = $node->wait_for_log(qr/reloading configuration files/);
+my $log_start = $node->wait_for_log(qr/reloading configuration files/);
 
 $ENV{PGOAUTHDEBUG} = "UNSAFE";
 
diff --git a/src/test/modules/test_aio/t/001_aio.pl b/src/test/modules/test_aio/t/001_aio.pl
index ef4e5247e5b..4527c70785d 100644
--- a/src/test/modules/test_aio/t/001_aio.pl
+++ b/src/test/modules/test_aio/t/001_aio.pl
@@ -560,7 +560,7 @@ INSERT INTO tmp_ok SELECT generate_series(1, 10000);
 		qr/^t$/,
 		qr/^$/);
 
-	# Because local buffers don't use IO_IN_PROGRESS, a second StartLocalBufer
+	# Because local buffers don't use IO_IN_PROGRESS, a second StartLocalBufferIO
 	# succeeds as well. This test mostly serves as a documentation of that
 	# fact. If we had actually started IO, it'd be different.
 	psql_like(
diff --git a/src/test/recovery/t/035_standby_logical_decoding.pl b/src/test/recovery/t/035_standby_logical_decoding.pl
index b85a4a4eda6..921813483e3 100644
--- a/src/test/recovery/t/035_standby_logical_decoding.pl
+++ b/src/test/recovery/t/035_standby_logical_decoding.pl
@@ -799,7 +799,7 @@ $logstart = -s $node_standby->logfile;
 reactive_slots_change_hfs_and_wait_for_xmins('no_conflict_', 'pruning_', 0,
 	0);
 
-# Injection_point avoids seeing a xl_running_xacts. This is required because if
+# Injection point avoids seeing a xl_running_xacts. This is required because if
 # it is generated between the last two updates, then the catalog_xmin of the
 # active slot could be updated, and hence, the conflict won't occur. See
 # comments atop wait_until_vacuum_can_remove.
diff --git a/src/test/subscription/t/007_ddl.pl b/src/test/subscription/t/007_ddl.pl
index de846193bb5..7d12bcbddb6 100644
--- a/src/test/subscription/t/007_ddl.pl
+++ b/src/test/subscription/t/007_ddl.pl
@@ -80,7 +80,7 @@ $node_subscriber->safe_psql('postgres', "DROP SUBSCRIPTION mysub1");
 # Test ALTER PUBLICATION RENAME command during the replication
 #
 
-# Test function for swaping name of publications
+# Test function for swapping name of publications
 sub test_swap
 {
 	my ($table_name, $pubname, $appname) = @_;

---

From: Michael Paquier <[email-masked]>
Date: Sat, 19 Apr 2025 19:04:28 +0900

> appeared since 2025-01-01:

Good finds, Alexander, particularly for the set of function and
variable names used in the comments that do not match with the
reality.  I've checked all these, and they're good for me.

> GIN_TUPLE_ -> GIN_TUPLE_H

This one is interested.  It should be harmless in practice, but it
could cause conflicts in theory.
--
Michael

---

From: Alexander Lakhin <[email-masked]>
Date: Sat, 19 Apr 2025 14:00:00 +0300

Hello Michael,

> reality.  I've checked all these, and they're good for me.

Thank you for your attention to this!

> could cause conflicts in theory.

I've included it in the collection because of:
#ifndef GIN_TUPLE_
...
#endif                                                   /* GIN_TUPLE_H */

Best regards,
Alexander Lakhin
Neon (https://neon.tech)

---

From: Alexander Lakhin <[email-masked]>
Date: Sun, 19 Apr 2026 22:00:00 +0300

Hello hackers,

Please look at another set of typos and inconsistencies introduced since
2026-01-01:
AttNumber -> AttrNumber

attytypids, attytypmods -> atttypids, atttypmods

AX handle  -> AH handle

big5_to_mic -> remove
(following 77645d44e)

bk_category -> bkcategory
(per postmaster/proctypelist.h)

BufferLockRelease -> BufferLockReleaseSub

build_index_scan -> build_index_scankeys

cacheoffset -> attcacheoff
(see index_getattr())

containg -> containing

Controlfile -> ControlFile

DataChecksumShmemRequest -> DataChecksumsShmemRequest

DataChecksumsLauncher -> DataChecksumsWorkerLauncherMain
(DataChecksumsWorkerLauncherMain() calls SetDataChecksumsOn(), which calls
EmitProcSignalBarrier())

Datachecksumsworker -> DataChecksumsWorker

dc_fake_temptable, dc_modify_db_result -> remove
(the implementation was removed in 07009121c)

determing -> determining

doublecheck -> double-check

Doublecheck -> Double-check

element_patterns -> path_pattern
(align with the implementation)

endTruncOff, endTruncMemb -> oldestMulti, oldestOffset
(align with the implementation)

expr_nulls[]  -> remove
(exprs_nulls[] was removed in
v2jsonb-0001-Add-support-for-exprs-in-pg_restore_extended.patch [1])

forPortionOfClause -> forPortionOf
(align with the implementation)

HeaptupleSatisfiesMVCC -> HeapTupleSatisfiesMVCC

hintbits -> hint bits

hostsfile -> hosts file

idenifier -> identifier

io_worker_launch_delay -> io_worker_launch_interval
(named io_worker_launch_delay in [2], but this name is absent in
v7-0001-aio-Adjust-I-O-worker-pool-size-automatically.patch attached
there)

load_from_disk_pending -> stashes_ready
(cf. "if (pg_atomic_unlocked_test_flag(&pgsa_state->stashes_ready))"
below)

LockManagerShmemSize -> remove the referencing sentence?
(following 9b5acad3f)

nonprivileged -> non-privileged

option_values -> option_value

oveflows -> overflows

path_pattern_lists -> path_elem_lists

paralell -> parallel

pg_buffercache_mark_dirt_relation -> pg_buffercache_mark_dirty_relation

pgpa_relation_identifier -> pgpa_identifier

pgstat_activity -> pg_stat_activity

pg_statistic.ext_data -> pg_statistic_ext_data

precalculated -> pre-calculated

PredicateLockShmemSize -> remove the referencing sentence?
(following 2e0943a85)

queryID -> Query ID

rel_dst -> cc_rel
(rel_dst existed in
v25-0004-Add-CONCURRENTLY-option-to-REPACK-command.patch [3], but then got
transformed into dest->rel in v26 [4] and then renamed to cc_rel)

relfrozen -> relfrozenxid
(as in other occurrences "relfrozenxid/relminmxid")

replorigin_session_origin -> replorigin_xact_state.origin

ResOwnerReleaseBufferPin -> ResOwnerReleaseBuffer
(see fcb9c977a)

RewriteGraphTable -> rewriteGraphTable

RTEkind -> RTE kind

SetHintBitExt -> SetHintBitsExt

signedess -> signedness

statsare -> stats are

SubPlanInfo -> SubPlanRTInfo

SubRTInfo -> SubPlanRTInfo

subsystemslist.h -> subsystemlist.h

swicthed -> switched

tablespacenames -> tablespace names

TABLE_UPDATE_WAIT -> remove the mention
("#define TABLE_UPDATE_WAIT" existed in
v46-0002-Add-CONCURRENTLY-option-to-REPACK-command.patch, but it was
removed in v47 [6].)

targetExpr -> targetRange
(see the code below)

testcluster -> test cluster

themself -> themselves

tkeys -> rids

truncation_block -> truncation_block_length

tupleTableSlot -> TupleTableSlot

VacAttrStatP -> VacAttrStatsP

XLOGShmemSize -> XLOGShmemRequest
(XLOGShmemRequest modifies wal_buffers)

[1] https://www.postgresql.org/message-id/CADkLM%3Ddu%2BOcctrsTk%2BhZryUGy%3D0OnPep-3LdGzut1nqF391%2BEg%40mail.gmail.com
[2] https://www.postgresql.org/message-id/CA%2BhUKGK%3DvELXFXNj2L%3DvTkof6s_EQzTjYXXrUVwOOW0rahEfVg%40mail.gmail.com
[3] https://www.postgresql.org/message-id/202510301734.pj4uds3mqxx4%40alvherre.pgsql
[4] https://www.postgresql.org/message-id/116433.1764870207%40localhost
[5] https://www.postgresql.org/message-id/202603292157.tnqxaozfjlkh%40alvherre.pgsql
[6] https://www.postgresql.org/message-id/202603311523.iqhng5ljkzpq%40alvherre.pgsql

Best regards,
Alexander

---

From: Alexander Lakhin <[email-masked]>
Date: Mon, 20 Apr 2026 04:00:01 +0300

> Please look at another set of typos and inconsistencies introduced since

Sorry, I forgot to attach the patch for your convenience.

Best regards,
Alexander

diff --git a/contrib/pg_overexplain/pg_overexplain.c b/contrib/pg_overexplain/pg_overexplain.c
index fb277e02308..a93a4dcfed6 100644
--- a/contrib/pg_overexplain/pg_overexplain.c
+++ b/contrib/pg_overexplain/pg_overexplain.c
@@ -459,7 +459,7 @@ overexplain_range_table(PlannedStmt *plannedstmt, ExplainState *es)
 		char	   *relkind;
 		SubPlanRTInfo *next_rtinfo;
 
-		/* Advance to next SubRTInfo, if it's time. */
+		/* Advance to next SubPlanRTInfo, if it's time. */
 		if (lc_subrtinfo != NULL)
 		{
 			next_rtinfo = lfirst(lc_subrtinfo);
@@ -512,8 +512,8 @@ overexplain_range_table(PlannedStmt *plannedstmt, ExplainState *es)
 				/*
 				 * We should not see RTE of this kind here since property
 				 * graph RTE gets converted to subquery RTE in
-				 * RewriteGraphTable(). In case we decide not to do the
-				 * conversion and leave RTEkind unchanged in future, print
+				 * rewriteGraphTable(). In case we decide not to do the
+				 * conversion and leave RTE kind unchanged in future, print
 				 * correct name of RTE kind.
 				 */
 				kind = "graph_table";
diff --git a/contrib/pg_plan_advice/pgpa_ast.c b/contrib/pg_plan_advice/pgpa_ast.c
index 3c340c6ae7a..01db8d24cd0 100644
--- a/contrib/pg_plan_advice/pgpa_ast.c
+++ b/contrib/pg_plan_advice/pgpa_ast.c
@@ -321,7 +321,7 @@ pgpa_identifiers_match_target(int nrids, pgpa_identifier *rids,
  * Returns true if every target or sub-target is matched by at least one
  * identifier, and otherwise false.
  *
- * Also sets rids_used[i] = true for each idenifier that matches at least one
+ * Also sets rids_used[i] = true for each identifier that matches at least one
  * target.
  */
 static bool
diff --git a/contrib/pg_plan_advice/pgpa_ast.h b/contrib/pg_plan_advice/pgpa_ast.h
index a89f1251929..4bd6ffa5e3a 100644
--- a/contrib/pg_plan_advice/pgpa_ast.h
+++ b/contrib/pg_plan_advice/pgpa_ast.h
@@ -116,7 +116,7 @@ typedef struct pgpa_advice_item
 } pgpa_advice_item;
 
 /*
- * Result of comparing an array of pgpa_relation_identifier objects to a
+ * Result of comparing an array of pgpa_identifier objects to a
  * pgpa_advice_target.
  *
  * PGPA_ITM_EQUAL means all targets are matched by some identifier, and
diff --git a/contrib/pg_plan_advice/pgpa_identifier.c b/contrib/pg_plan_advice/pgpa_identifier.c
index 0cfc4aa4f7e..9d620c70bb9 100644
--- a/contrib/pg_plan_advice/pgpa_identifier.c
+++ b/contrib/pg_plan_advice/pgpa_identifier.c
@@ -211,7 +211,7 @@ pgpa_compute_identifier_by_rti(PlannerInfo *root, Index rti,
  * RTE_JOIN entries are excluded because they cannot be mentioned by plan
  * advice.
  *
- * The caller is responsible for making sure that the tkeys array is large
+ * The caller is responsible for making sure that the rids array is large
  * enough to store the results.
  *
  * The return value is the number of identifiers computed.
diff --git a/contrib/pg_plan_advice/pgpa_join.c b/contrib/pg_plan_advice/pgpa_join.c
index 38e7b91ed7e..067321081e7 100644
--- a/contrib/pg_plan_advice/pgpa_join.c
+++ b/contrib/pg_plan_advice/pgpa_join.c
@@ -93,7 +93,7 @@ pgpa_create_join_unroller(void)
  *
  * pgpa_plan_walker creates a "top level" join unroller object when it
  * encounters a join in a portion of the plan tree in which no join unroller
- * is already active. From there, this function is responsible for determing
+ * is already active. From there, this function is responsible for determining
  * to what portion of the plan tree that join unroller applies, and for
  * creating any subordinate join unroller objects that are needed as a result
  * of non-outer-deep join trees. We do this by returning the join unroller
diff --git a/contrib/pg_plan_advice/pgpa_planner.c b/contrib/pg_plan_advice/pgpa_planner.c
index 72ef3230abc..4b44a98fcbc 100644
--- a/contrib/pg_plan_advice/pgpa_planner.c
+++ b/contrib/pg_plan_advice/pgpa_planner.c
@@ -1648,13 +1648,14 @@ pgpa_planner_apply_scan_advice(RelOptInfo *rel,
 			/*
 			 * Currently, PGS_CONSIDER_INDEXONLY can suppress Bitmap Heap
 			 * Scans, so don't clear it when such a scan is requested. This
-			 * happens because build_index_scan() thinks that the possibility
-			 * of an index-only scan is a sufficient reason to consider using
-			 * an otherwise-useless index, and get_index_paths() thinks that
-			 * the same paths that are useful for index or index-only scans
-			 * should also be considered for bitmap scans. Perhaps that logic
-			 * should be tightened up, but until then we need to include
-			 * PGS_CONSIDER_INDEXONLY in my_scan_type here.
+			 * happens because build_index_scankeys() thinks that the
+			 * possibility of an index-only scan is a sufficient reason to
+			 * consider using an otherwise-useless index, and
+			 * get_index_paths() thinks that the same paths that are useful
+			 * for index or index-only scans should also be considered for
+			 * bitmap scans. Perhaps that logic should be tightened up, but
+			 * until then we need to include PGS_CONSIDER_INDEXONLY in
+			 * my_scan_type here.
 			 */
 			my_scan_type = PGS_BITMAPSCAN | PGS_CONSIDER_INDEXONLY;
 		}
@@ -2083,7 +2084,7 @@ pgpa_compute_rt_offsets(pgpa_planner_state *pps, PlannedStmt *pstmt)
 
 		/*
 		 * It's not guaranteed that every plan name we saw during planning has
-		 * a SubPlanInfo, but any that do not certainly don't appear in the
+		 * a SubPlanRTInfo, but any that do not certainly don't appear in the
 		 * final range table.
 		 */
 		foreach_node(SubPlanRTInfo, rtinfo, pstmt->subrtinfos)
diff --git a/contrib/pg_stash_advice/stashfuncs.c b/contrib/pg_stash_advice/stashfuncs.c
index 77f8e19e867..d7aa9f2223f 100644
--- a/contrib/pg_stash_advice/stashfuncs.c
+++ b/contrib/pg_stash_advice/stashfuncs.c
@@ -286,7 +286,7 @@ pg_set_stashed_advice(PG_FUNCTION_ARGS)
 	/*
 	 * Get and check query ID.
 	 *
-	 * queryID 0 means no query ID was computed, so reject that.
+	 * Query ID 0 means no query ID was computed, so reject that.
 	 */
 	queryId = PG_GETARG_INT64(1);
 	if (queryId == 0)
diff --git a/contrib/pg_stash_advice/stashpersist.c b/contrib/pg_stash_advice/stashpersist.c
index 07a4da65b7e..00a0a74f04d 100644
--- a/contrib/pg_stash_advice/stashpersist.c
+++ b/contrib/pg_stash_advice/stashpersist.c
@@ -85,7 +85,7 @@ static void pgsa_write_to_disk(void);
 /*
  * Background worker entry point for pg_stash_advice persistence.
  *
- * On startup, if load_from_disk_pending is set, we load previously saved
+ * On startup, if stashes_ready is set, we load previously saved
  * stash data from disk.  Then we enter a loop, periodically checking whether
  * any changes have been made (via the change_count atomic counter) and
  * writing them to disk.  On shutdown, we perform a final write.
diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c
index 0aca9b5826f..3fd087852e7 100644
--- a/contrib/pg_trgm/trgm_op.c
+++ b/contrib/pg_trgm/trgm_op.c
@@ -242,7 +242,7 @@ CMPTRGM_CHOOSE(const void *a, const void *b)
 #define ST_DECLARE
 #include "lib/sort_template.h"
 
-/* Sort an array of trigrams, handling signedess correctly */
+/* Sort an array of trigrams, handling signedness correctly */
 static void
 trigram_qsort(trgm *array, size_t n)
 {
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 0f20f38c83e..c42cb690c7b 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -5798,7 +5798,7 @@ fetch_remote_statistics(Relation relation,
 													  remote_relname,
 													  column_list.data);
 
-			/* If any attribute statsare missing, fallback to sampling. */
+			/* If any attribute stats are missing, fallback to sampling. */
 			if (!match_attrmap(attstats,
 							   local_schemaname, local_relname,
 							   remote_schemaname, remote_relname,
diff --git a/doc/src/sgml/pgstashadvice.sgml b/doc/src/sgml/pgstashadvice.sgml
index c9b1e078382..7813d63d91e 100644
--- a/doc/src/sgml/pgstashadvice.sgml
+++ b/doc/src/sgml/pgstashadvice.sgml
@@ -84,7 +84,7 @@
   <literal>pg_stash_advice.stash_name</literal> for their session, and this
   may reveal the contents of any advice stash with that name. Users should
   assume that information embedded in stashed advice strings may become visible
-  to nonprivileged users.
+  to non-privileged users.
  </para>
 
  <sect2 id="pgstashadvice-functions">
diff --git a/doc/src/sgml/ref/alter_property_graph.sgml b/doc/src/sgml/ref/alter_property_graph.sgml
index 19352c06305..f517f2b2d7a 100644
--- a/doc/src/sgml/ref/alter_property_graph.sgml
+++ b/doc/src/sgml/ref/alter_property_graph.sgml
@@ -78,7 +78,7 @@ ALTER PROPERTY GRAPH [ IF EXISTS ] <replaceable class="parameter">name</replacea
       <para>
        This form removes vertex or edge tables from the property graph.  (Only
        the association of the tables with the graph is removed.  The tables
-       themself are not dropped.)
+       themselves are not dropped.)
       </para>
      </listitem>
     </varlistentry>
diff --git a/doc/src/sgml/release-19.sgml b/doc/src/sgml/release-19.sgml
index 6a8dfa0526f..c1bf18abfd3 100644
--- a/doc/src/sgml/release-19.sgml
+++ b/doc/src/sgml/release-19.sgml
@@ -3231,7 +3231,7 @@ Add functions to pg_buffercache to mark buffers as dirty (Nazir Bilal Yavuz)
 </para>
 
 <para>
-The functions are pg_buffercache_mark_dirty(), pg_buffercache_mark_dirt_relation(), and pg_buffercache_mark_dirty_all().
+The functions are pg_buffercache_mark_dirty(), pg_buffercache_mark_dirty_relation(), and pg_buffercache_mark_dirty_all().
 </para>
 </listitem>
 
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index a2db55e9b73..60bba0a2145 100644
--- a/src/backend/access/common/indextuple.c
+++ b/src/backend/access/common/indextuple.c
@@ -222,7 +222,7 @@ index_form_tuple_context(TupleDesc tupleDescriptor,
  *		nocache_index_getattr
  *
  *		This gets called from index_getattr() macro, and only in cases
- *		where we can't use cacheoffset and the value is not null.
+ *		where we can't use attcacheoff and the value is not null.
  * ----------------
  */
 Datum
diff --git a/src/backend/access/heap/heapam_visibility.c b/src/backend/access/heap/heapam_visibility.c
index 3a6a1e5a084..361b76e5065 100644
--- a/src/backend/access/heap/heapam_visibility.c
+++ b/src/backend/access/heap/heapam_visibility.c
@@ -192,7 +192,7 @@ SetHintBitsExt(HeapTupleHeader tuple, Buffer buffer,
 }
 
 /*
- * Simple wrapper around SetHintBitExt(), use when operating on a single
+ * Simple wrapper around SetHintBitsExt(), use when operating on a single
  * tuple.
  */
 static inline void
@@ -1671,7 +1671,7 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
 }
 
 /*
- * Perform HeaptupleSatisfiesMVCC() on each passed in tuple. This is more
+ * Perform HeapTupleSatisfiesMVCC() on each passed in tuple. This is more
  * efficient than doing HeapTupleSatisfiesMVCC() one-by-one.
  *
  * To be checked tuples are passed via BatchMVCCState->tuples. Each tuple's
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index cb78ba0842d..10cbc0d76bd 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -341,8 +341,8 @@ static void ExtendMultiXactMember(MultiXactOffset offset, int nmembers);
 static void SetOldestOffset(void);
 static bool find_multixact_start(MultiXactId multi, MultiXactOffset *result);
 static void WriteMTruncateXlogRec(Oid oldestMultiDB,
-								  MultiXactId endTruncOff,
-								  MultiXactOffset endTruncMemb);
+								  MultiXactId oldestMulti,
+								  MultiXactOffset oldestOffset);

 /*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index f85b5286086..e39af79c03b 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -668,7 +668,7 @@ static TimeLineID LocalMinRecoveryPointTLI;
 static bool updateMinRecoveryPoint = true;
 
 /*
- * Local state for Controlfile data_checksum_version.  After initialization
+ * Local state for ControlFile data_checksum_version.  After initialization
  * this is only updated when absorbing a procsignal barrier during interrupt
  * processing.  The reason for keeping a copy in backend-private memory is to
  * avoid locking for interrogating the data checksum state.  Possible values
@@ -5045,7 +5045,7 @@ check_wal_buffers(int *newval, void **extra, GucSource source)
 	{
 		/*
 		 * If we haven't yet changed the boot_val default of -1, just let it
-		 * be.  We'll fix it when XLOGShmemSize is called.
+		 * be.  We'll fix it when XLOGShmemRequest is called.
 		 */
 		if (XLOGbuffers == -1)
 			return true;
diff --git a/src/backend/commands/explain_state.c b/src/backend/commands/explain_state.c
index 0e07a63fca6..a0ee0a664be 100644
--- a/src/backend/commands/explain_state.c
+++ b/src/backend/commands/explain_state.c
@@ -435,7 +435,7 @@ GUCCheckExplainExtensionOption(const char *option_name,
  * for an EXPLAIN extension option, the caller is entitled to assume that
  * a suitably constructed DefElem passed to the main option handler will
  * not cause an error. To construct this DefElem, the caller should set
- * the DefElem's defname to option_name. If option_values is NULL, arg
+ * the DefElem's defname to option_name. If option_value is NULL, arg
  * should be NULL. Otherwise, arg should be of the type given by
  * option_type, with option_value as the associated value. The only option
  * types that should be passed are T_String, T_Float, and T_Integer; in
diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c
index 67364cc60e3..4a9dc7b164d 100644
--- a/src/backend/commands/repack.c
+++ b/src/backend/commands/repack.c
@@ -104,7 +104,7 @@ typedef struct ChangeContext
 	/* The relation the changes are applied to. */
 	Relation	cc_rel;
 
-	/* Needed to update indexes of rel_dst. */
+	/* Needed to update indexes of cc_rel. */
 	ResultRelInfo *cc_rri;
 	EState	   *cc_estate;
 
diff --git a/src/backend/commands/vacuumparallel.c b/src/backend/commands/vacuumparallel.c
index 979c2be4abd..41cefcfde54 100644
--- a/src/backend/commands/vacuumparallel.c
+++ b/src/backend/commands/vacuumparallel.c
@@ -545,7 +545,7 @@ parallel_vacuum_end(ParallelVacuumState *pvs, IndexBulkDeleteResult **istats)
 /*
  * DSM detach callback. This is invoked when an autovacuum worker detaches
  * from the DSM segment holding PVShared. It ensures to reset the local pointer
- * to the shared state even if paralell vacuum raises an error and doesn't
+ * to the shared state even if parallel vacuum raises an error and doesn't
  * call parallel_vacuum_end().
  */
 static void
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index f08982a43cc..9810a62e6ce 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -1403,7 +1403,7 @@ MakeTupleTableSlot(TupleDesc tupleDesc,
 		 * Precalculate the maximum guaranteed attribute that has to exist in
 		 * every tuple which gets deformed into this slot.  When the
 		 * TTS_FLAG_OBEYS_NOT_NULL_CONSTRAINTS flag is enabled, we simply take
-		 * the precalculated value from the tupleDesc, otherwise the
+		 * the pre-calculated value from the tupleDesc, otherwise the
 		 * optimization is disabled, and we set the value to 0.
 		 */
 		if ((flags & TTS_FLAG_OBEYS_NOT_NULL_CONSTRAINTS) != 0)
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index ef2a6bc6e9d..b013f8356ee 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -1430,7 +1430,7 @@ ExecForPortionOfLeftovers(ModifyTableContext *context,
 		/*
 		 * If we don't have a ForPortionOfState yet, we must be a partition
 		 * child being hit for the first time. Make a copy from the root, with
-		 * our own tupleTableSlot. We do this lazily so that we don't pay the
+		 * our own TupleTableSlot. We do this lazily so that we don't pay the
 		 * price of unused partitions.
 		 */
 		ForPortionOfState *leafState = makeNode(ForPortionOfState);
diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
index a3e222f3a3d..f64b2787f66 100644
--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -200,7 +200,7 @@ be_tls_init(bool isServerStart)
 	 *
 	 * The reason for not doing everything in this if-else conditional is that
 	 * we want to use the same processing of postgresql.conf for when ssl_sni
-	 * is off as well as when it's on but the hostsfile is missing etc.  Thus
+	 * is off as well as when it's on but the hosts file is missing etc.  Thus
 	 * we set res to the state and continue with a new conditional instead of
 	 * duplicating logic and risk it diverging over time.
 	 */
@@ -208,7 +208,7 @@ be_tls_init(bool isServerStart)
 	{
 		/*
 		 * The GUC check hook should have already blocked this but to be on
-		 * the safe side we doublecheck here.
+		 * the safe side we double-check here.
 		 */
 #ifndef HAVE_SSL_CTX_SET_CLIENT_HELLO_CB
 		ereport(isServerStart ? FATAL : LOG,
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 84deed9aaa6..cb4e5019c2f 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -80,7 +80,7 @@ static OnConflictExpr *transformOnConflictClause(ParseState *pstate,
 												 OnConflictClause *onConflictClause);
 static ForPortionOfExpr *transformForPortionOfClause(ParseState *pstate,
 													 int rtindex,
-													 const ForPortionOfClause *forPortionOfClause,
+													 const ForPortionOfClause *forPortionOf,
 													 bool isUpdate);
 static int	count_rowexpr_columns(ParseState *pstate, Node *expr);
 static Query *transformSelectStmt(ParseState *pstate, SelectStmt *stmt,
diff --git a/src/backend/parser/parse_graphtable.c b/src/backend/parser/parse_graphtable.c
index 30ddce5aa9f..f889c8df4e3 100644
--- a/src/backend/parser/parse_graphtable.c
+++ b/src/backend/parser/parse_graphtable.c
@@ -157,7 +157,7 @@ transformGraphTablePropertyRef(ParseState *pstate, ColumnRef *cref)
  * A label expression is parsed as either a ColumnRef with a single field or a
  * label expression like label disjunction. The single field in the ColumnRef is
  * treated as a label name and transformed to a GraphLabelRef node. The label
- * expression is recursively transformed into an expression tree containg
+ * expression is recursively transformed into an expression tree containing
  * GraphLabelRef nodes corresponding to the names of the labels appearing in the
  * expression. If any label name cannot be resolved to a label in the property
  * graph, an error is raised.
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 680db664be4..a5a8db2ff88 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -3047,7 +3047,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
  *
  * One exception to the previous paragraph is for tables nearing wraparound,
  * i.e., those that have surpassed the effective failsafe ages.  In that case,
- * the relfrozen/relminmxid-based score is scaled aggressively so that the
+ * the relfrozenxid/relminmxid-based score is scaled aggressively so that the
  * table has a decent chance of sorting to the front of the list.
  *
  * To adjust how strongly each component contributes to the score, the
diff --git a/src/backend/postmaster/datachecksum_state.c b/src/backend/postmaster/datachecksum_state.c
index 18797a8ee3d..3a060cbcceb 100644
--- a/src/backend/postmaster/datachecksum_state.c
+++ b/src/backend/postmaster/datachecksum_state.c
@@ -99,12 +99,12 @@
  * state will also be set to "off".
  *
  * Backends transition Bd -> Bi via a procsignalbarrier which is emitted by the
- * DataChecksumsLauncher.  When all backends have acknowledged the barrier then
- * Bd will be empty and the next phase can begin: calculating and writing data
- * checksums with DataChecksumsWorkers.  When the DataChecksumsWorker processes
- * have finished writing checksums on all pages, data checksums are enabled
- * cluster-wide via another procsignalbarrier. There are four sets of backends
- * where Bd shall be an empty set:
+ * DataChecksumsWorkerLauncherMain.  When all backends have acknowledged the
+ * barrier then  Bd will be empty and the next phase can begin: calculating and
+ * writing data checksums with DataChecksumsWorkers.  When the
+ * DataChecksumsWorker processes have finished writing checksums on all pages,
+ * data checksums are enabled cluster-wide via another procsignalbarrier.
+ * There are four sets of backends where Bd shall be an empty set:
  *
  * Bg: Backend updating the global state and emitting the procsignalbarrier
  * Bd: Backends in "off" state
@@ -634,7 +634,7 @@ ProcessSingleRelationFork(Relation reln, ForkNumber forkNum, BufferAccessStrateg
 
 	relns = get_namespace_name(RelationGetNamespace(reln));
 
-	/* Report the current relation to pgstat_activity */
+	/* Report the current relation to pg_stat_activity */
 	snprintf(activity, sizeof(activity) - 1, "processing: %s.%s (%s, %u blocks)",
 			 (relns ? relns : ""), RelationGetRelationName(reln), forkNames[forkNum], numblocks);
 	pgstat_report_activity(STATE_RUNNING, activity);
@@ -659,7 +659,7 @@ ProcessSingleRelationFork(Relation reln, ForkNumber forkNum, BufferAccessStrateg
 		 * re-write the page to WAL even if the checksum hasn't changed,
 		 * because if there is a replica it might have a slightly different
 		 * version of the page with an invalid checksum, caused by unlogged
-		 * changes (e.g. hintbits) on the primary happening while checksums
+		 * changes (e.g. hint bits) on the primary happening while checksums
 		 * were off. This can happen if there was a valid checksum on the page
 		 * at one point in the past, so only when checksums are first on, then
 		 * off, and then turned on again.  TODO: investigate if this could be
@@ -1262,7 +1262,7 @@ ProcessAllDatabases(void)
 }
 
 /*
- * DataChecksumShmemRequest
+ * DataChecksumsShmemRequest
  *		Request datachecksumsworker-related shared memory
  */
 static void
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c
index 372d77c475e..c9dfb094c2b 100644
--- a/src/backend/replication/logical/origin.c
+++ b/src/backend/replication/logical/origin.c
@@ -1371,7 +1371,7 @@ replorigin_session_get_progress(bool flush)
 /*
  * Clear the per-transaction replication origin state.
  *
- * replorigin_session_origin is also cleared if clear_origin is set.
+ * replorigin_xact_state.origin is also cleared if clear_origin is set.
  */
 void
 replorigin_xact_clear(bool clear_origin)
diff --git a/src/backend/rewrite/rewriteGraphTable.c b/src/backend/rewrite/rewriteGraphTable.c
index 2c3199d3230..7b64818e369 100644
--- a/src/backend/rewrite/rewriteGraphTable.c
+++ b/src/backend/rewrite/rewriteGraphTable.c
@@ -91,10 +91,10 @@ struct path_element
 
 static Node *replace_property_refs(Oid propgraphid, Node *node, const List *mappings);
 static List *build_edge_vertex_link_quals(HeapTuple edgetup, int edgerti, int refrti, Oid refid, AttrNumber catalog_key_attnum, AttrNumber catalog_ref_attnum, AttrNumber catalog_eqop_attnum);
-static List *generate_queries_for_path_pattern(RangeTblEntry *rte, List *element_patterns);
+static List *generate_queries_for_path_pattern(RangeTblEntry *rte, List *path_pattern);
 static Query *generate_query_for_graph_path(RangeTblEntry *rte, List *path);
 static Node *generate_setop_from_pathqueries(List *pathqueries, List **rtable, List **targetlist);
-static List *generate_queries_for_path_pattern_recurse(RangeTblEntry *rte, List *pathqueries, List *cur_path, List *path_pattern_lists, int elempos);
+static List *generate_queries_for_path_pattern_recurse(RangeTblEntry *rte, List *pathqueries, List *cur_path, List *path_elem_lists, int elempos);
 static Query *generate_query_for_empty_path_pattern(RangeTblEntry *rte);
 static Query *generate_union_from_pathqueries(List **pathqueries);
 static List *get_path_elements_for_path_factor(Oid propgraphid, struct path_factor *pf);
diff --git a/src/backend/statistics/extended_stats_funcs.c b/src/backend/statistics/extended_stats_funcs.c
index 9279904b465..9108187477c 100644
--- a/src/backend/statistics/extended_stats_funcs.c
+++ b/src/backend/statistics/extended_stats_funcs.c
@@ -571,7 +571,7 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 
 	/*
 	 * Either of these statistic types requires that we supply a semi-filled
-	 * VacAttrStatP array.
+	 * VacAttrStatsP array.
 	 *
 	 * It is not possible to use the existing lookup_var_attr_stats() and
 	 * examine_attribute() because these functions will skip attributes where
@@ -586,7 +586,7 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 
 		/*
 		 * The leading stxkeys are attribute numbers up through numattnums.
-		 * These keys must be in ascending AttNumber order, but we do not rely
+		 * These keys must be in ascending AttrNumber order, but we do not rely
 		 * on that.
 		 */
 		for (int i = 0; i < numattnums; i++)
@@ -724,7 +724,7 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 		/*
 		 * Generate the expressions array.
 		 *
-		 * The attytypids, attytypmods, and atttypcolls arrays have all the
+		 * The atttypids, atttypmods, and atttypcolls arrays have all the
 		 * regular attributes listed first, so we can pass those arrays with a
 		 * start point after the last regular attribute.  There are numexprs
 		 * elements remaining.
@@ -1091,7 +1091,7 @@ array_in_safe(FmgrInfo *array_in, const char *s, Oid typid, int32 typmod,
  * still return a legit tuple datum.
  *
  * Set pg_statistic_ok to true if all of the values found in the container
- * were imported without issue.  pg_statistic_ok is swicthed to "true" once
+ * were imported without issue.  pg_statistic_ok is switched to "true" once
  * the full pg_statistic tuple has been built and validated.
  */
 static Datum
@@ -1307,10 +1307,6 @@ import_pg_statistic(Relation pgsd, JsonbContainer *cont,
 	 * if they aren't then we need to reject that stakind completely.
 	 * Currently we go a step further and reject the expression array
 	 * completely.
-	 *
-	 * Once it is established that the pairs are in NULL/NOT-NULL alignment,
-	 * we can test either expr_nulls[] value to see if the stakind has
-	 * value(s) that we can set or not.
 	 */
 
 	if (found[MOST_COMMON_VALS_ELEM])
diff --git a/src/backend/storage/aio/method_worker.c b/src/backend/storage/aio/method_worker.c
index 061a93d90d4..63e34d66690 100644
--- a/src/backend/storage/aio/method_worker.c
+++ b/src/backend/storage/aio/method_worker.c
@@ -814,7 +814,7 @@ IoWorkerMain(const void *startup_data, size_t startup_data_len)
 			 * it.  Crossing the current worker count is a useful signal
 			 * because it's clearly too deep to avoid queuing latency already,
 			 * but still leaves a small window of opportunity to improve the
-			 * situation before the queue oveflows.
+			 * situation before the queue overflows.
 			 *
 			 * 2. The worker pool is keeping up, no latency is being
 			 * introduced and an extra worker would be a waste of resources.
@@ -830,10 +830,10 @@ IoWorkerMain(const void *startup_data, size_t startup_data_len)
 			 *
 			 * On its own, this is an extremely crude signal.  When combined
 			 * with the wakeup propagation test that precedes it (but on its
-			 * own tends to overshoot) and io_worker_launch_delay, the result
-			 * is that we gradually test each pool size until we find one that
-			 * doesn't trigger further expansion, and then hold it for at
-			 * least io_worker_idle_timeout.
+			 * own tends to overshoot) and io_worker_launch_interval, the
+			 * result is that we gradually test each pool size until we find
+			 * one that doesn't trigger further expansion, and then hold it
+			 * for at least io_worker_idle_timeout.
 			 *
 			 * XXX Perhaps ideas from queueing theory or control theory could
 			 * do a better job of this.
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 3cc0b0bdd92..32f501bbd21 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -5844,7 +5844,7 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
  * Used to clean up after errors.
  *
  * Currently, we can expect that resource owner cleanup, via
- * ResOwnerReleaseBufferPin(), took care of releasing buffer content locks per
+ * ResOwnerReleaseBuffer(), took care of releasing buffer content locks per
  * se; the only thing we need to deal with here is clearing any PIN_COUNT
  * request that was in progress.
  */
@@ -5993,7 +5993,7 @@ BufferLockAcquire(Buffer buffer, BufferDesc *buf_hdr, BufferLockMode mode)
 
 		pgstat_report_wait_end();
 
-		/* Retrying, allow BufferLockRelease to release waiters again. */
+		/* Retrying, allow BufferLockReleaseSub to release waiters again. */
 		pg_atomic_fetch_and_u64(&buf_hdr->state, ~BM_LOCK_WAKE_IN_PROGRESS);
 	}
 
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index bf6b81e621b..e149a738c8d 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -169,7 +169,7 @@ RegisterBuiltinShmemCallbacks(void)
 {
 	/*
 	 * Call RegisterShmemCallbacks(...) on each subsystem listed in
-	 * subsystemslist.h
+	 * subsystemlist.h
 	 */
 #define PG_SHMEM_SUBSYSTEM(subsystem_callbacks) \
 	RegisterShmemCallbacks(&(subsystem_callbacks));
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index c221fe96889..8d246ed5a4e 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -453,8 +453,7 @@ LockManagerShmemRequest(void *arg)
 	int64		max_table_size;
 
 	/*
-	 * Compute sizes for lock hashtables.  Note that these calculations must
-	 * agree with LockManagerShmemSize!
+	 * Compute sizes for lock hashtables.
 	 */
 	max_table_size = NLOCKENTS();
 
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index 899a4ef06e4..0ae85b7d5b4 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1156,8 +1156,7 @@ PredicateLockShmemRequest(void *arg)
 		);
 
 	/*
-	 * Compute size for serializable transaction hashtable. Note these
-	 * calculations must agree with PredicateLockShmemSize!
+	 * Compute size for serializable transaction hashtable.
 	 *
 	 * Assume an average of 10 predicate locking transactions per backend.
 	 * This allows aggressive cleanup while detail is present before data must
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 090e8cc28c1..78587d223cb 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -13352,7 +13352,7 @@ get_for_portion_of(ForPortionOfExpr *forPortionOf, deparse_context *context)
 
 		/*
 		 * Try to write it as FROM ... TO ... if we received it that way,
-		 * otherwise (targetExpr).
+		 * otherwise (targetRange).
 		 */
 		if (forPortionOf->targetFrom && forPortionOf->targetTo)
 		{
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index ad960336e8d..1b8a73f589a 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -2353,7 +2353,7 @@ DebugFileOpen(void)
  * GUC check_hook for log_min_messages
  *
  * This value is parsed as a comma-separated list of zero or more TYPE:LEVEL
- * elements.  For each element, TYPE corresponds to a bk_category value (see
+ * elements.  For each element, TYPE corresponds to a bkcategory value (see
  * postmaster/proctypelist.h); LEVEL is one of server_message_level_options.
  *
  * In addition, there must be a single LEVEL element (with no TYPE part)
diff --git a/src/bin/pg_combinebackup/t/011_ib_truncation.pl b/src/bin/pg_combinebackup/t/011_ib_truncation.pl
index c5e0124c04d..e1ce4521558 100644
--- a/src/bin/pg_combinebackup/t/011_ib_truncation.pl
+++ b/src/bin/pg_combinebackup/t/011_ib_truncation.pl
@@ -102,7 +102,8 @@ is($vm_limits, '1',
 	'WAL summary has correct VM fork truncation limit');
 
 # Combine full and incremental backups.  Before the fix, this failed because
-# the INCREMENTAL file header contained an incorrect truncation_block value.
+# the INCREMENTAL file header contained an incorrect truncation_block_length
+# value.
 my $restored = PostgreSQL::Test::Cluster->new('node2');
 $restored->init_from_backup($primary, 'incr', combine_with_prior => ['full']);
 $restored->start();
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 1ca03d6b278..d56dcc701ce 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -18861,7 +18861,7 @@ dumpStatisticsExtStats(Archive *fout, const StatsExtInfo *statsextinfo)
 		{
 			/*
 			 * There is no ordering column in pg_stats_ext_exprs.  However, we
-			 * can rely on the unnesting of pg_statistic.ext_data.stxdexpr to
+			 * can rely on the unnesting of pg_statistic_ext_data.stxdexpr to
 			 * maintain the desired order of expression elements.
 			 */
 			appendPQExpBufferStr(pq,
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index f016b336308..95f4ac110b9 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -704,7 +704,7 @@ restore_one_database(const char *inputFileSpec, RestoreOptions *opts,
 	 * We don't have a connection yet but that doesn't matter. The connection
 	 * is initialized to NULL and if we terminate through exit_nicely() while
 	 * it's still NULL, the cleanup function will just be a no-op. If we are
-	 * restoring multiple databases, then only update AX handle for cleanup as
+	 * restoring multiple databases, then only update AH handle for cleanup as
 	 * the previous entry was already in the array and we had closed previous
 	 * connection, so we can use the same array slot.
 	 */
diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index 06134cf5d2e..5a7afe62eab 100644
--- a/src/bin/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -2601,7 +2601,7 @@ check_old_cluster_global_names(ClusterInfo *cluster)
 	conn_template1 = connectToServer(cluster, "template1");
 
 	/*
-	 * Get database, user/role and tablespacenames from cluster.  Can't use
+	 * Get database, user/role and tablespace names from cluster.  Can't use
 	 * pg_authid because only superusers can view it.
 	 */
 	res = executeQueryOrDie(conn_template1,
diff --git a/src/common/wchar.c b/src/common/wchar.c
index a44ee73accf..4c77e3e1dc8 100644
--- a/src/common/wchar.c
+++ b/src/common/wchar.c
@@ -26,9 +26,9 @@
  * this pair specifically.  Byte pair range constraints, in encoding
  * originator documentation, always excluded this pair.  No core conversion
  * could translate it.  However, longstanding verifychar implementations
- * accepted any non-NUL byte.  big5_to_euc_tw and big5_to_mic even translate
- * pairs not valid per encoding originator documentation.  To avoid tightening
- * core or non-core conversions in a security patch, we sought this one pair.
+ * accepted any non-NUL byte.  big5_to_euc_tw even translates pairs not
+ * valid per encoding originator documentation.  To avoid tightening core
+ * or non-core conversions in a security patch, we sought this one pair.
  *
  * PQescapeString() historically used spaces for BYTE1; many other values
  * could suffice for BYTE1.
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index c13f05d39db..f2c36696bca 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -1570,8 +1570,6 @@ table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid,
  *	crosscheck - if not InvalidSnapshot, also check old tuple against this
  *	options - These allow the caller to specify options that may change the
  *	behavior of the AM. The AM will ignore options that it does not support.
- *		TABLE_UPDATE_WAIT -- set if should wait for any conflicting update to
- *		commit/abort
  *		TABLE_UPDATE_NO_LOGICAL -- force-disables the emitting of logical
  *		decoding information for the tuple.
  *
diff --git a/src/include/postmaster/datachecksum_state.h b/src/include/postmaster/datachecksum_state.h
index 05625539604..7acb3b43ab8 100644
--- a/src/include/postmaster/datachecksum_state.h
+++ b/src/include/postmaster/datachecksum_state.h
@@ -17,7 +17,7 @@
 
 #include "storage/procsignal.h"
 
-/* Possible operations the Datachecksumsworker can perform */
+/* Possible operations the DataChecksumsWorker can perform */
 typedef enum DataChecksumsWorkerOperation
 {
 	ENABLE_DATACHECKSUMS,
diff --git a/src/test/modules/test_checksums/t/003_standby_restarts.pl b/src/test/modules/test_checksums/t/003_standby_restarts.pl
index 7ad11417ca6..11e15c9d734 100644
--- a/src/test/modules/test_checksums/t/003_standby_restarts.pl
+++ b/src/test/modules/test_checksums/t/003_standby_restarts.pl
@@ -110,7 +110,7 @@ $node_primary->wait_for_catchup($node_standby, 'replay');
 # Ensure that the primary and standby has switched to off
 wait_for_checksum_state($node_primary, 'off');
 wait_for_checksum_state($node_standby, 'off');
-# Doublecheck reading data without errors
+# Double-check reading data without errors
 $result =
   $node_primary->safe_psql('postgres', "SELECT count(a) FROM t WHERE a > 1");
 is($result, "19998", 'ensure we can safely read all data without checksums');
diff --git a/src/test/modules/test_checksums/t/005_injection.pl b/src/test/modules/test_checksums/t/005_injection.pl
index a37a24dbbad..7240b93bdd1 100644
--- a/src/test/modules/test_checksums/t/005_injection.pl
+++ b/src/test/modules/test_checksums/t/005_injection.pl
@@ -25,7 +25,7 @@ if ($ENV{enable_injection_points} ne 'yes')
 # Test cluster setup
 #
 
-# Initiate testcluster
+# Initiate test cluster
 my $node = PostgreSQL::Test::Cluster->new('injection_node');
 $node->init(no_data_checksums => 1);
 $node->start;
diff --git a/src/test/modules/test_checksums/test_checksums.c b/src/test/modules/test_checksums/test_checksums.c
index c2eabc2821c..621cf788dad 100644
--- a/src/test/modules/test_checksums/test_checksums.c
+++ b/src/test/modules/test_checksums/test_checksums.c
@@ -22,8 +22,6 @@
 PG_MODULE_MAGIC;
 
 extern PGDLLEXPORT void dc_delay_barrier(const char *name, const void *private_data, void *arg);
-extern PGDLLEXPORT void dc_modify_db_result(const char *name, const void *private_data, void *arg);
-extern PGDLLEXPORT void dc_fake_temptable(const char *name, const void *private_data, void *arg);
 
 /*
  * Test for delaying emission of procsignalbarriers.

---

From: Daniil Davydov <[email-masked]>
Date: Mon, 20 Apr 2026 13:11:48 +0700

Hi,

On Mon, Apr 20, 2026 at 2:00 AM Alexander Lakhin <[email-masked]> wrote:
> 2026-01-01

I've found a few other typos. Although they are quite old, I think they should
be mentioned here :

1) Typo in tidstore.c
"Find the shared the shared radix tree" --> "Find the shared radix tree".

2) A bit inconsistent comment in twophase.c
```
/*
 * Recreates a state file. This is used in WAL replay and during
 * checkpoint creation.
 *
 * Note: content and len don't include CRC.
 */
static void
RecreateTwoPhaseFile(FullTransactionId fxid, void *content, int len)
```

This comment was introduced in the implementation of the two-phase commit [1].
At that time, this function was actually used during replaying the
XLOG_XACT_PREPARE record. Commit [2] changed that code, so now this function is
used only during checkpoint and restartpoint creation.

If restartpoint creation can be considered as part of the WAL replay, we can
leave this comment as is. Otherwise, I suggest changing it to something like
this :
/*
 * Recreates a state file. This is used during checkpoint/restartpoint creation.
 *
 * Note: content and len don't include CRC.
 */

Another idea - we can stop listing the places of function's usage so that we
don't need to touch this comment later.

[1] d0a89683a3a4dd8e76ef0a99101355999e519df5
[2] 728bd991c3c4389fb39c45dcb0fe57e4a1dccd71

--
Best regards,
Daniil Davydov

---

From: Michael Paquier <[email-masked]>
Date: Tue, 21 Apr 2026 13:23:35 +0900

> Sorry, I forgot to attach the patch for your convenience.

I have a bunch of these lying around, already addressed, but not all.
I'll go incorporate your patch to plug in all the other holes you are
pointing at now.  With that included, I have a nice stack that has
accumulated, so I will merge quickly.  The plan is to do so roughly
every two months, depending on the numbers.
--
Michael