Subject: Re: Typos in the code and README

From: David Rowley <[email-masked]>
Date: Sun, 28 Apr 2024 20:05:06 +1200

On Sat, 20 Apr 2024 at 16:09, David Rowley <[email-masked]> wrote:
> Here are a few more to see if it motivates anyone else to do a more
> thorough search for another batch.

I've pushed these now.

David

---

From: Alexander Lakhin <[email-masked]>
Date: Thu, 2 May 2024 15:00:00 +0300

Hello,

>> thorough search for another batch.

Please look also at the list of other typos and inconsistencies I've found
on the master branch:
additional_notnulls -> old_notnulls (cf. b0e96f311)
ATAddCheckConstraint ->? ATAddCheckNNConstraint (cf. b0e96f311)
bt_page_check -> bt_target_page_check (cf. 5ae208720)
calblack_arg -> callback_arg
combinig -> combining
compaining -> complaining
ctllock - remove (cf. 53c2a97a9)
dabatase -> database
eval_const_exprs_mutator -> eval_const_expressions_mutator
ExecEndValuesScan - remove (cf. d060e921e)
get_json_nested_columns -> get_json_table_nested_columns
io_direct -> debug_io_direct
iS ->? IS (a neatnik-ism)
joing ->? join (cf. 20f90a0e4)
_jumbleRangeTblEntry - remove (cf. 367c989cd)
Mallroy -> Mallory
onstead -> instead
procedual -> procedural
psql_safe -> safe_psql
read_quoted_pattern -> read_quoted_string
repertiore -> repertoire
rightfirstdataoffset ->? rightfirstoffset (cf. 5ae208720)
Sincle ->? Since (perhaps the whole sentence could be rephrased)
sslnegotition=direct/requiredirectwould -> sslnegotiation=direct/requiredirect would
sslnegotitation -> sslnegotiation
walreciever -> walreceiver
xid_wrapround -> xid_wraparound

(some of them are located in doc/, so it's not a code-only change)
I've attached the patch for your convenience, though maybe some
of the suggestions are to be discarded.

Best regards,
Alexander

diff --git a/contrib/amcheck/verify_nbtree.c b/contrib/amcheck/verify_nbtree.c
index 20da4a46ba..70f65b645a 100644
--- a/contrib/amcheck/verify_nbtree.c
+++ b/contrib/amcheck/verify_nbtree.c
@@ -1086,7 +1086,7 @@ bt_entry_unique_check(BtreeCheckState *state, IndexTuple itup,
 
 	/*
 	 * Current tuple has no posting list. If TID is visible save info about it
-	 * for the next comparisons in the loop in bt_page_check(). Report
+	 * for the next comparisons in the loop in bt_target_page_check(). Report
 	 * duplicate if lVis_tid is already valid.
 	 */
 	else
@@ -1953,7 +1953,7 @@ bt_target_page_check(BtreeCheckState *state)
  * Note that !readonly callers must reverify that target page has not
  * been concurrently deleted.
  *
- * Save rightfirstdataoffset for detailed error message.
+ * Save rightfirstoffset for detailed error message.
  */
 static BTScanInsert
 bt_right_page_check_scankey(BtreeCheckState *state, OffsetNumber *rightfirstoffset)
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index d7e78204ad..f4b00399e4 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -331,7 +331,7 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
      <term><literal>xid_wraparound</literal></term>
      <listitem>
       <para>
-       Runs the test suite under <filename>src/test/module/xid_wrapround</filename>.
+       Runs the test suite under <filename>src/test/module/xid_wraparound</filename>.
        Not enabled by default because it is resource intensive.
       </para>
      </listitem>
diff --git a/doc/src/sgml/targets-meson.txt b/doc/src/sgml/targets-meson.txt
index 1c42dd3028..bd470c87a7 100644
--- a/doc/src/sgml/targets-meson.txt
+++ b/doc/src/sgml/targets-meson.txt
@@ -11,7 +11,7 @@ Code Targets:
   backend                       Build backend and related modules
   bin                           Build frontend binaries
   contrib                       Build contrib modules
-  pl                            Build procedual languages
+  pl                            Build procedural languages
 
 Developer Targets:
   reformat-dat-files            Rewrite catalog data files into standard format
diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c
index bf28400dd8..d0f3848c95 100644
--- a/src/backend/access/brin/brin.c
+++ b/src/backend/access/brin/brin.c
@@ -2598,7 +2598,7 @@ _brin_parallel_heapscan(BrinBuildState *state)
  *
  * 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/transam/slru.c b/src/backend/access/transam/slru.c
index f99ec38a4a..77b05cc0a7 100644
--- a/src/backend/access/transam/slru.c
+++ b/src/backend/access/transam/slru.c
@@ -228,7 +228,6 @@ SimpleLruAutotuneBuffers(int divisor, int max)
  * name: name of SLRU.  (This is user-visible, pick with care!)
  * nslots: number of page slots to use.
  * nlsns: number of LSN groups per page (set to zero if not relevant).
- * ctllock: LWLock to use to control access to the shared control structure.
  * subdir: PGDATA-relative subdirectory that will contain the files.
  * buffer_tranche_id: tranche ID to use for the SLRU's per-buffer LWLocks.
  * bank_tranche_id: tranche ID to use for the bank LWLocks.
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 34a2c71812..c3fd9c1eae 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8507,7 +8507,7 @@ xlog_redo(XLogReaderState *record)
 
 /*
  * Return the extra open flags used for opening a file, depending on the
- * value of the GUCs wal_sync_method, fsync and io_direct.
+ * value of the GUCs wal_sync_method, fsync and debug_io_direct.
  */
 static int
 get_sync_bit(int method)
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index f0278b9c01..1d9f26965b 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -2465,7 +2465,7 @@ AddRelationNewConstraints(Relation rel,
 				 * Check against pre-existing constraints.  If we are allowed
 				 * to merge with an existing constraint, there's no more to do
 				 * here. (We omit the duplicate constraint from the result,
-				 * which is what ATAddCheckConstraint wants.)
+				 * which is what ATAddCheckNNConstraint wants.)
 				 */
 				if (MergeWithExistingConstraint(rel, ccname, expr,
 												allow_merge, is_local,
diff --git a/src/backend/executor/nodeValuesscan.c b/src/backend/executor/nodeValuesscan.c
index 78b512931b..92948917a0 100644
--- a/src/backend/executor/nodeValuesscan.c
+++ b/src/backend/executor/nodeValuesscan.c
@@ -18,7 +18,6 @@
  *		ExecValuesScan			scans a values list.
  *		ExecValuesNext			retrieve next tuple in sequential order.
  *		ExecInitValuesScan		creates and initializes a valuesscan node.
- *		ExecEndValuesScan		releases any storage allocated.
  *		ExecReScanValuesScan	rescans the values list
  */
 #include "postgres.h"
diff --git a/src/backend/nodes/queryjumblefuncs.c b/src/backend/nodes/queryjumblefuncs.c
index be823a7f8f..129fb44709 100644
--- a/src/backend/nodes/queryjumblefuncs.c
+++ b/src/backend/nodes/queryjumblefuncs.c
@@ -57,7 +57,6 @@ static void RecordConstLocation(JumbleState *jstate, int location);
 static void _jumbleNode(JumbleState *jstate, Node *node);
 static void _jumbleA_Const(JumbleState *jstate, Node *node);
 static void _jumbleList(JumbleState *jstate, Node *node);
-static void _jumbleRangeTblEntry(JumbleState *jstate, Node *node);
 
 /*
  * Given a possibly multi-statement source string, confine our attention to the
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 39ff5fe969..389e7db2c6 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -1041,7 +1041,7 @@ ValidateSlotSyncParams(int elevel)
 	/*
 	 * Logical slot sync/creation requires wal_level >= logical.
 	 *
-	 * Sincle altering the wal_level requires a server restart, so error out
+	 * Since altering the wal_level requires a server restart, so error out
 	 * in this case regardless of elevel provided by caller.
 	 */
 	if (wal_level < WAL_LEVEL_LOGICAL)
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index b3428e2ae4..302cd8e7f3 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -11632,7 +11632,7 @@ get_xmltable(TableFunc *tf, deparse_context *context, bool showimplicit)
 }
 
 /*
- * get_json_nested_columns - Parse back nested JSON_TABLE columns
+ * get_json_table_nested_columns - Parse back nested JSON_TABLE columns
  */
 static void
 get_json_table_nested_columns(TableFunc *tf, JsonTablePlan *plan,
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index d1b09dedfd..dccd130c91 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -6284,7 +6284,7 @@ unicode_norm_form_from_string(const char *formstr)
 /*
  * Returns version of Unicode used by Postgres in "major.minor" format (the
  * same format as the Unicode version reported by ICU). The third component
- * ("update version") never involves additions to the character repertiore and
+ * ("update version") never involves additions to the character repertoire and
  * is unimportant for most purposes.
  *
  * See: https://unicode.org/versions/
diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c
index 027a16a26c..f4a1f49953 100644
--- a/src/bin/pg_combinebackup/pg_combinebackup.c
+++ b/src/bin/pg_combinebackup/pg_combinebackup.c
@@ -844,7 +844,7 @@ process_directory_recursively(Oid tsoid,
 	 * files requiring reconstruction. If such files occur outside these
 	 * directories, we want to just copy them straight to the output
 	 * directory. This is to protect against a user creating a file with a
-	 * strange name like INCREMENTAL.config and then compaining that
+	 * strange name like INCREMENTAL.config and then complaining that
 	 * incremental backups don't work properly. The test here is a bit tricky:
 	 * incremental files occur in subdirectories of base, in pg_global itself,
 	 * and in subdirectories of pg_tblspc only if in-place tablespaces are
diff --git a/src/bin/pg_dump/filter.c b/src/bin/pg_dump/filter.c
index 9fdb9cbdcd..3fb93c5f15 100644
--- a/src/bin/pg_dump/filter.c
+++ b/src/bin/pg_dump/filter.c
@@ -204,7 +204,7 @@ filter_get_keyword(const char **line, int *size)
 }
 
 /*
- * read_quoted_pattern - read quoted possibly multi line string
+ * read_quoted_string - read quoted possibly multi line string
  *
  * Reads a quoted string which can span over multiple lines and returns a
  * pointer to next char after ending double quotes; it will exit on errors.
diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index ad1f8e3bcb..11e705e8ec 100644
--- a/src/bin/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -1945,7 +1945,7 @@ check_old_cluster_subscription_state(void)
 									"	ON o.roname = 'pg_' || s.oid "
 									"INNER JOIN pg_catalog.pg_database d "
 									"	ON d.oid = s.subdbid "
-									"WHERE o.roname iS NULL;");
+									"WHERE o.roname IS NULL;");
 
 			ntup = PQntuples(res);
 			for (int i = 0; i < ntup; i++)
diff --git a/src/fe_utils/recovery_gen.c b/src/fe_utils/recovery_gen.c
index 733982a82f..c4838a4bdd 100644
--- a/src/fe_utils/recovery_gen.c
+++ b/src/fe_utils/recovery_gen.c
@@ -20,7 +20,7 @@ static char *escape_quotes(const char *src);
  * return it.
  *
  * This accepts the dbname which will be appended to the primary_conninfo.
- * The dbname will be ignored by walreciever process but slotsync worker uses
+ * The dbname will be ignored by walreceiver process but slotsync worker uses
  * it to connect to the primary server.
  */
 PQExpBuffer
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h
index 21e31f9c97..e446d49b3e 100644
--- a/src/include/catalog/heap.h
+++ b/src/include/catalog/heap.h
@@ -116,7 +116,7 @@ extern List *AddRelationNewConstraints(Relation rel,
 									   const char *queryString);
 extern List *AddRelationNotNullConstraints(Relation rel,
 										   List *constraints,
-										   List *additional_notnulls);
+										   List *old_notnulls);
 
 extern void RelationClearMissing(Relation rel);
 extern void SetAttrMissing(Oid relid, char *attname, char *value);
diff --git a/src/include/common/blkreftable.h b/src/include/common/blkreftable.h
index 42295b7c52..43b913a82e 100644
--- a/src/include/common/blkreftable.h
+++ b/src/include/common/blkreftable.h
@@ -44,7 +44,7 @@ typedef struct BlockRefTableWriter BlockRefTableWriter;
  * report_error_fn should not return.
  */
 typedef int (*io_callback_fn) (void *callback_arg, void *data, int length);
-typedef void (*report_error_fn) (void *calblack_arg, char *msg,...) pg_attribute_printf(2, 3);
+typedef void (*report_error_fn) (void *callback_arg, char *msg,...) pg_attribute_printf(2, 3);

 /*
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index b8141f141a..91a6ce90d8 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -1867,7 +1867,7 @@ typedef struct ForeignPath
  *
  * We provide a set of hooks here - which the provider must take care to set
  * up correctly - to allow extensions to supply their own methods of scanning
- * a relation or joing relations.  For example, a provider might provide GPU
+ * a relation or join relations.  For example, a provider might provide GPU
  * acceleration, a cache-based scan, or some other kind of logic we haven't
  * dreamed up yet.
  *
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 247cecb4b4..43f5766d73 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -1641,7 +1641,7 @@ typedef struct JsonReturning
  *
  * The actual value is obtained by evaluating formatted_expr.  raw_expr is
  * only there for displaying the original user-written expression and is not
- * evaluated by ExecInterpExpr() and eval_const_exprs_mutator().
+ * evaluated by ExecInterpExpr() and eval_const_expressions_mutator().
  */
 typedef struct JsonValueExpr
 {
diff --git a/src/interfaces/libpq/t/005_negotiate_encryption.pl b/src/interfaces/libpq/t/005_negotiate_encryption.pl
index 1c37f832e7..03a9079f3f 100644
--- a/src/interfaces/libpq/t/005_negotiate_encryption.pl
+++ b/src/interfaces/libpq/t/005_negotiate_encryption.pl
@@ -395,7 +395,7 @@ nogssuser   disable      disable      *              connect, authok
 	# The expected events and outcomes above assume that SSL support
 	# is enabled. When libpq is compiled without SSL support, all
 	# attempts to connect with sslmode=require or
-	# sslnegotition=direct/requiredirectwould fail immediately without
+	# sslnegotiation=direct/requiredirect would fail immediately without
 	# even connecting to the server. Skip those, because we tested
 	# them earlier already.
 	my ($sslmodes, $sslnegotiations);
@@ -552,7 +552,7 @@ done_testing();
 
 ### Helper functions
 
-# Test the cube of parameters: user, gssencmode, sslmode, and sslnegotitation
+# Test the cube of parameters: user, gssencmode, sslmode, and sslnegotiation
 sub test_matrix
 {
 	local $Test::Builder::Level = $Test::Builder::Level + 1;
diff --git a/src/test/authentication/t/006_login_trigger.pl b/src/test/authentication/t/006_login_trigger.pl
index 8229490ae2..30d852a96a 100644
--- a/src/test/authentication/t/006_login_trigger.pl
+++ b/src/test/authentication/t/006_login_trigger.pl
@@ -143,7 +143,7 @@ psql_command(
 	log_exact => '2',
 	err_like => [qr/You are welcome/]);
 
-# Try to login as allowed Alice.  We don't check the Mallroy login, because
+# Try to login as allowed Alice.  We don't check the Mallory login, because
 # FATAL error could cause a timing-dependant panic of IPC::Run.
 psql_command(
 	$node, 'SELECT 1;', 0, 'try regress_alice',
diff --git a/src/test/modules/test_json_parser/t/004_test_parser_perf.pl b/src/test/modules/test_json_parser/t/004_test_parser_perf.pl
index c61fdf898a..e82bb3695b 100644
--- a/src/test/modules/test_json_parser/t/004_test_parser_perf.pl
+++ b/src/test/modules/test_json_parser/t/004_test_parser_perf.pl
@@ -4,7 +4,7 @@
 # Test the JSON parser performance tester. Here we are just checking that
 # the performance tester can run, both with the standard parser and the
 # incremental parser. An actual performance test will run with thousands
-# of iterations onstead of just one.
+# of iterations instead of just one.
 
 use strict;
 use warnings;
diff --git a/src/test/modules/worker_spi/t/001_worker_spi.pl b/src/test/modules/worker_spi/t/001_worker_spi.pl
index 177e1c6314..fcd76b43e8 100644
--- a/src/test/modules/worker_spi/t/001_worker_spi.pl
+++ b/src/test/modules/worker_spi/t/001_worker_spi.pl
@@ -115,7 +115,7 @@ my $noconndb_id = $node->safe_psql('mydb',
 my $log_offset = -s $node->logfile;
 
 # worker_spi_launch() may be able to detect that the worker has been
-# stopped, so do not rely on psql_safe().
+# stopped, so do not rely on safe_psql().
 $node->psql('postgres',
 	qq[SELECT worker_spi_launch(12, $noconndb_id, $myrole_id);]);
 $node->wait_for_log(
diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c
index 22177cf2b5..7e1042f4ab 100644
--- a/src/test/modules/worker_spi/worker_spi.c
+++ b/src/test/modules/worker_spi/worker_spi.c
@@ -384,7 +384,7 @@ _PG_init(void)
 	/*
 	 * Now fill in worker-specific data, and do the actual registrations.
 	 *
-	 * bgw_extra can optionally include a dabatase OID, a role OID and a set
+	 * bgw_extra can optionally include a database OID, a role OID and a set
 	 * of flags.  This is left empty here to fallback to the related GUCs at
 	 * startup (0 for the bgworker flags).
 	 */

---

From: David Rowley <[email-masked]>
Date: Sat, 4 May 2024 02:36:35 +1200

> of the suggestions are to be discarded.

Thanks. I was hoping you'd do that.

I pushed the patch after only adjusting the path in the docs which had
"module" rather than "modules".

David

---

From: Alexander Lakhin <[email-masked]>
Date: Thu, 4 Jul 2024 20:00:01 +0300

Hello hackers,

> "module" rather than "modules".

Please look at another bunch of inconsistencies/orphaned entities I found
in the tree, with the possible substitutions:
errmsg_buf -> errormsg_buf
(coined by 6b18b3fe2)

NoMovementScanDirectionScans -> NoMovementScanDirection
(introduced with e9aaf0632, discussed in [1], but still seems inaccurate)

XLogReadRecordInternal -> XLogReadRecord
(from 3f1ce9734, align with a comment above: "Start and end point of last
record returned by XLogReadRecord().")

BYPASS_ALLOWCONN -> BGWORKER_BYPASS_ROLELOGINCHECK (see 492217301)

xs_ctup.t_self -> xs_heaptid (see c2fe139c2 and 304532421)

pgStatShmLookupCache -> pgStatLocal.shmem (coined by 5891c7a8e)

smgr_fsm_nblocks and smgr_vm_nblocks -> smgr_cached_nblocks
(see the same comment updated by c5315f4f4)

XID becomes older than GlobalXmin -> XID becomes visible to everyone
(in accordance with dc7420c2c9 src/backend/access/gist/gistutil.c)

gen-rtab - remove (non-existing since db7d1a7b0)

BARRIER_SHOULD_CHECK - remove (unused since a3ed4d1ef)

EXE_EXT - remove (unused since f06b1c598)

endterm - remove
(see 60c90c16c -- Use xreflabel attributes instead of endterm ...)

xl_commit_ts_set, SizeOfCommitTsSet - remove (unused since 08aa89b32)

The corresponding patch is attached for your convenience.

[1] https://www.postgresql.org/message-id/20230131140224.7j6gbcsfwmad2a4b%40liskov

Best regards,
Alexander

diff --git a/contrib/pgcrypto/Makefile b/contrib/pgcrypto/Makefile
index 5efa10c334..85f1c94681 100644
--- a/contrib/pgcrypto/Makefile
+++ b/contrib/pgcrypto/Makefile
@@ -45,8 +45,6 @@ REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
 	pgp-armor pgp-decrypt pgp-encrypt pgp-encrypt-md5 $(CF_PGP_TESTS) \
 	pgp-pubkey-decrypt pgp-pubkey-encrypt pgp-info
 
-EXTRA_CLEAN = gen-rtab
-
 ifdef USE_PGXS
 PG_CONFIG = pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/doc/src/sgml/README.links b/doc/src/sgml/README.links
index 65df9c111f..900e0308b6 100644
--- a/doc/src/sgml/README.links
+++ b/doc/src/sgml/README.links
@@ -15,10 +15,6 @@ Intra-document Linking
 linkend=
 	controls the target of the link/xref, required
 
-endterm=
-	for <xref>, allows the text of the link/xref to be taken from a
-	different link target title
-
 <link>
 	use to supply text for the link, only uses linkend, requires </link>
 	http://www.oasis-open.org/docbook/documentation/reference/html/link.html
diff --git a/src/backend/access/gist/gistvacuum.c b/src/backend/access/gist/gistvacuum.c
index 24fb94f473..59372783d0 100644
--- a/src/backend/access/gist/gistvacuum.c
+++ b/src/backend/access/gist/gistvacuum.c
@@ -643,7 +643,7 @@ gistdeletepage(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
 	 * The page cannot be immediately recycled, because in-progress scans that
 	 * saw the downlink might still visit it.  Mark the page with the current
 	 * next-XID counter, so that we know when it can be recycled.  Once that
-	 * XID becomes older than GlobalXmin, we know that all scans that are
+	 * XID becomes visible to everyone, we know that all scans that are
 	 * currently in progress must have ended.  (That's much more conservative
 	 * than needed, but let's keep it safe and simple.)
 	 */
diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index 37d2a57961..45bc17e7f4 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -946,7 +946,7 @@ err:
 	XLogReaderInvalReadState(state);
 
 	/*
-	 * If an error was written to errmsg_buf, it'll be returned to the caller
+	 * If an error was written to errormsg_buf, it'll be returned to the caller
 	 * of XLogReadRecord() after all successfully decoded records from the
 	 * read queue.
 	 */
diff --git a/src/backend/executor/execCurrent.c b/src/backend/executor/execCurrent.c
index 70c62ac110..5285b84d30 100644
--- a/src/backend/executor/execCurrent.c
+++ b/src/backend/executor/execCurrent.c
@@ -200,7 +200,7 @@ execCurrentOf(CurrentOfExpr *cexpr,
 			/*
 			 * For IndexOnlyScan, the tuple stored in ss_ScanTupleSlot may be
 			 * a virtual tuple that does not have the ctid column, so we have
-			 * to get the TID from xs_ctup.t_self.
+			 * to get the TID from xs_heaptid.
 			 */
 			IndexScanDesc scan = ((IndexOnlyScanState *) scanstate)->ioss_ScanDesc;
 
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 4ed9cedcdd..d9a84b66e0 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -88,10 +88,6 @@ typedef struct
  */
 #define NumProcSignalSlots	(MaxBackends + NUM_AUXILIARY_PROCS)
 
-/* Check whether the relevant type bit is set in the flags. */
-#define BARRIER_SHOULD_CHECK(flags, type) \
-	(((flags) & (((uint32) 1) << (uint32) (type))) != 0)
-
 /* Clear the relevant type bit from the flags. */
 #define BARRIER_CLEAR_BIT(flags, type) \
 	((flags) &= ~(((uint32) 1) << (uint32) (type)))
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c
index a691aed1f4..75e16b9b94 100644
--- a/src/backend/storage/smgr/smgr.c
+++ b/src/backend/storage/smgr/smgr.c
@@ -733,8 +733,8 @@ smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks, BlockNumber *nb
 		/*
 		 * We might as well update the local smgr_cached_nblocks values. The
 		 * smgr cache inval message that this function sent will cause other
-		 * backends to invalidate their copies of smgr_fsm_nblocks and
-		 * smgr_vm_nblocks, and these ones too at the next command boundary.
+		 * backends to invalidate their copies of smgr_cached_nblocks, and
+		 * these ones too at the next command boundary.
 		 * But these ensure they aren't outright wrong until then.
 		 */
 		reln->smgr_cached_nblocks[forknum[i]] = nblocks[i];
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index 634b967820..1cd16fc133 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -80,7 +80,7 @@ static const dshash_parameters dsh_params = {
  * compares to their copy of pgStatSharedRefAge on a regular basis.
  */
 static pgstat_entry_ref_hash_hash *pgStatEntryRefHash = NULL;
-static int	pgStatSharedRefAge = 0; /* cache age of pgStatShmLookupCache */
+static int	pgStatSharedRefAge = 0; /* cache age of pgStatLocal.shmem */
 
 /*
  * Memory contexts containing the pgStatEntryRefHash table and the
@@ -861,7 +861,7 @@ pgstat_drop_database_and_contents(Oid dboid)
 
 	/*
 	 * If some of the stats data could not be freed, signal the reference
-	 * holders to run garbage collection of their cached pgStatShmLookupCache.
+	 * holders to run garbage collection of their cached pgStatLocal.shmem.
 	 */
 	if (not_freed_count > 0)
 		pgstat_request_entry_refs_gc();
diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h
index 8afe240bdf..98458bda9b 100644
--- a/src/bin/pg_upgrade/pg_upgrade.h
+++ b/src/bin/pg_upgrade/pg_upgrade.h
@@ -96,7 +96,6 @@ extern char *output_files[];
 #define RMDIR_CMD			"@RMDIR /s/q"
 #define SCRIPT_PREFIX		""
 #define SCRIPT_EXT			"bat"
-#define EXE_EXT				".exe"
 #define ECHO_QUOTE	""
 #define ECHO_BLANK	"."
 #endif
diff --git a/src/include/access/commit_ts.h b/src/include/access/commit_ts.h
index 82d3aa8627..c18faea76d 100644
--- a/src/include/access/commit_ts.h
+++ b/src/include/access/commit_ts.h
@@ -46,17 +46,6 @@ extern int	committssyncfiletag(const FileTag *ftag, char *path);
 #define COMMIT_TS_ZEROPAGE		0x00
 #define COMMIT_TS_TRUNCATE		0x10
 
-typedef struct xl_commit_ts_set
-{
-	TimestampTz timestamp;
-	RepOriginId nodeid;
-	TransactionId mainxid;
-	/* subxact Xids follow */
-}			xl_commit_ts_set;
-
-#define SizeOfCommitTsSet	(offsetof(xl_commit_ts_set, mainxid) + \
-							 sizeof(TransactionId))
-
 typedef struct xl_commit_ts_truncate
 {
 	int64		pageno;
diff --git a/src/include/access/sdir.h b/src/include/access/sdir.h
index d40d809bd2..c720096f1a 100644
--- a/src/include/access/sdir.h
+++ b/src/include/access/sdir.h
@@ -17,7 +17,7 @@
 
 /*
  * Defines the direction for scanning a table or an index.  Scans are never
- * invoked using NoMovementScanDirectionScans.  For convenience, we use the
+ * invoked using NoMovementScanDirection.  For convenience, we use the
  * values -1 and 1 for backward and forward scans.  This allows us to perform
  * a few mathematical tricks such as what is done in ScanDirectionCombine.
  */
diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h
index 2e9e5f43eb..5af6dc54e9 100644
--- a/src/include/access/xlogreader.h
+++ b/src/include/access/xlogreader.h
@@ -224,7 +224,7 @@ struct XLogReaderState
 	 * should not be accessed directly.
 	 * ----------------------------------------
 	 * Start and end point of the last record read and decoded by
-	 * XLogReadRecordInternal().  NextRecPtr is also used as the position to
+	 * XLogReadRecord().  NextRecPtr is also used as the position to
 	 * decode next.  Calling XLogBeginRead() sets NextRecPtr and EndRecPtr to
 	 * the requested starting position.
 	 */
diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c
index 7e1042f4ab..de8f46902b 100644
--- a/src/test/modules/worker_spi/worker_spi.c
+++ b/src/test/modules/worker_spi/worker_spi.c
@@ -174,9 +174,10 @@ worker_spi_main(Datum main_arg)
 											 worker_spi_role, flags);
 
 	/*
-	 * Disable parallel query for workers started with BYPASS_ALLOWCONN or
-	 * BGWORKER_BYPASS_ALLOWCONN so as these don't attempt connections using a
-	 * database or a role that may not allow that.
+	 * Disable parallel query for workers started with
+	 * BGWORKER_BYPASS_ALLOWCONN or BGWORKER_BYPASS_ROLELOGINCHECK so as these
+	 * don't attempt connections using a database or a role that may not allow
+	 * that.
 	 */
 	if ((flags & (BGWORKER_BYPASS_ALLOWCONN | BGWORKER_BYPASS_ROLELOGINCHECK)))
 		SetConfigOption("max_parallel_workers_per_gather", "0",

---

From: Daniel Gustafsson <[email-masked]>
Date: Thu, 25 Jul 2024 15:45:32 +0200

> On 4 Jul 2024, at 19:00, Alexander Lakhin <[email-masked]> wrote:

> in the tree, with the possible substitutions:

Thanks for these, and sorry for the delay in processing them (summer happened
etc).  I've started to go through them and have applied some low-hanging fruit
already, will go over all them.

--
Daniel Gustafsson

---

From: David Rowley <[email-masked]>
Date: Mon, 12 Aug 2024 23:59:31 +1200

(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.)

> errmsg_buf -> errormsg_buf

Fixed.

> (introduced with e9aaf0632, discussed in [1], but still seems inaccurate)

Oops. Fixed.

> record returned by XLogReadRecord().")

Fixed.

> BYPASS_ALLOWCONN -> BGWORKER_BYPASS_ROLELOGINCHECK (see 492217301)

Fixed

> xs_ctup.t_self -> xs_heaptid (see c2fe139c2 and 304532421)

Fixed.

> pgStatShmLookupCache -> pgStatLocal.shmem (coined by 5891c7a8e)

Fixed.

> (see the same comment updated by c5315f4f4)

Heikki fixed in 19de089cd.

> (in accordance with dc7420c2c9 src/backend/access/gist/gistutil.c)

I'd need to spend more time to understand this.

> gen-rtab - remove (non-existing since db7d1a7b0)

Daniel fixed in cc59f9d0f.

> BARRIER_SHOULD_CHECK - remove (unused since a3ed4d1ef)

I wasn't sure if nothing else external could be using this. The macro
doesn't use any fields that are now gone, so I'm not confident enough
to remove it. Can Robert confirm?

> EXE_EXT - remove (unused since f06b1c598)

Daniel fixed in 88e3da565.

> (see 60c90c16c -- Use xreflabel attributes instead of endterm ...)

I read that commit message and I agree it's now unused. I just didn't
get any vibes from the commit message that it shouldn't ever be used
again.  Can Tom confirm?

> xl_commit_ts_set, SizeOfCommitTsSet - remove (unused since 08aa89b32)

I would say it should be removed.  I just didn't because the commit I
had pending fitted into the "typos" category and this didn't quite
fit.

I've attached a patch with the remainder.

David