diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index d51b43be54..62aa999931 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -1396,7 +1396,7 @@ read_tablespace_map(List **tablespaces)
  *
  * This does not close the 'xlogreader' yet, because in some cases the caller
  * still wants to re-read the last checkpoint record by calling
- * ReadCheckPointRecord().
+ * ReadCheckpointRecord().
  *
  * Returns the position of the last valid or applied record, after which new
  * WAL should be appended, information about why recovery was ended, and some
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index e3a170c38b..256632c985 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -432,7 +432,7 @@ AtEOXact_SPI(bool isCommit)
 
 	/*
 	 * Pop stack entries, stopping if we find one marked internal_xact (that
-	 * one belongs to the caller of SPI_commit or SPI_abort).
+	 * one belongs to the caller of SPI_commit or SPI_rollback).
 	 */
 	while (_SPI_connected >= 0)
 	{
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index ea91ce355f..fc05e2e293 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -2000,7 +2000,7 @@ static inline GlobalVisHorizonKind
 GlobalVisHorizonKindForRel(Relation rel)
 {
 	/*
-	 * Other relkkinds currently don't contain xids, nor always the necessary
+	 * Other relkinds currently don't contain xids, nor always the necessary
 	 * logical decoding markers.
 	 */
 	Assert(!rel ||
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index 9ca9835aab..fa03cbbadf 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -517,7 +517,7 @@ qsort_tuple_unsigned_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
 }
 
 #if SIZEOF_DATUM >= 8
-/* Used if first key's comparator is ssup_datum_signed_compare */
+/* Used if first key's comparator is ssup_datum_signed_cmp */
 static pg_attribute_always_inline int
 qsort_tuple_signed_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
 {
@@ -541,7 +541,7 @@ qsort_tuple_signed_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
 }
 #endif
 
-/* Used if first key's comparator is ssup_datum_int32_compare */
+/* Used if first key's comparator is ssup_datum_int32_cmp */
 static pg_attribute_always_inline int
 qsort_tuple_int32_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
 {
diff --git a/src/include/utils/pgstat_internal.h b/src/include/utils/pgstat_internal.h
index 6badb2fde4..60fbf9394b 100644
--- a/src/include/utils/pgstat_internal.h
+++ b/src/include/utils/pgstat_internal.h
@@ -102,7 +102,7 @@ typedef struct PgStatShared_HashEntry
 } PgStatShared_HashEntry;
 
 /*
- * Common header struct for PgStatShm_Stat*Entry.
+ * Common header struct for PgStatShared_*.
  */
 typedef struct PgStatShared_Common
 {
diff --git a/src/interfaces/libpq/fe-trace.c b/src/interfaces/libpq/fe-trace.c
index abaab6a073..402784f40e 100644
--- a/src/interfaces/libpq/fe-trace.c
+++ b/src/interfaces/libpq/fe-trace.c
@@ -74,7 +74,7 @@ PQsetTraceFlags(PGconn *conn, int flags)
 /*
  * Print the current time, with microseconds, into a caller-supplied
  * buffer.
- * Cribbed from setup_formatted_log_time, but much simpler.
+ * Cribbed from get_formatted_log_time, but much simpler.
  */
 static void
 pqTraceFormatTimestamp(char *timestr, size_t ts_len)
diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c
index a4d66f3057..010a97378c 100644
--- a/src/pl/plpython/plpy_main.c
+++ b/src/pl/plpython/plpy_main.c
@@ -306,7 +306,7 @@ plpython3_inline_handler(PG_FUNCTION_ARGS)
 		/*
 		 * Setup error traceback support for ereport().
 		 * plpython_inline_error_callback doesn't currently need exec_ctx, but
-		 * for consistency with plpython_call_handler we do it the same way.
+		 * for consistency with plpython3_call_handler we do it the same way.
 		 */
 		plerrcontext.callback = plpython_inline_error_callback;
 		plerrcontext.arg = exec_ctx;
diff --git a/src/test/subscription/t/013_partition.pl b/src/test/subscription/t/013_partition.pl
index f03cd24246..275fb3b525 100644
--- a/src/test/subscription/t/013_partition.pl
+++ b/src/test/subscription/t/013_partition.pl
@@ -564,7 +564,7 @@ is($result, qq(), 'inserts into tab4_1 replicated');
 
 
 # now switch the order of publications in the list, try again, the result
-# should be the same (no dependence on order of pulications)
+# should be the same (no dependence on order of publications)
 $node_subscriber2->safe_psql('postgres',
 	"ALTER SUBSCRIPTION sub2 SET PUBLICATION pub_all, pub_lower_level");
 
diff --git a/src/test/subscription/t/023_twophase_stream.pl b/src/test/subscription/t/023_twophase_stream.pl
index 1cc871fddb..f4af44414b 100644
--- a/src/test/subscription/t/023_twophase_stream.pl
+++ b/src/test/subscription/t/023_twophase_stream.pl
@@ -264,7 +264,7 @@ sub test_streaming
 	is($result, qq(1), 'transaction is prepared on subscriber');
 
 	# Insert a different record (now we are outside of the 2PC transaction)
-	# Note: the 2PC transaction still holds row locks so make sure this insert is for a separare primary key
+	# Note: the 2PC transaction still holds row locks so make sure this insert is for a separate primary key
 	$node_publisher->safe_psql('postgres',
 		"INSERT INTO test_tab VALUES (99999, 'foobar')");
 
