diff --git a/contrib/hstore/hstore_op.c b/contrib/hstore/hstore_op.c
index 87f1aef3a3..a3a8a91827 100644
--- a/contrib/hstore/hstore_op.c
+++ b/contrib/hstore/hstore_op.c
@@ -682,8 +682,8 @@ hstore_slice_to_hstore(PG_FUNCTION_ARGS)
 	}
 
 	/*
-	 * we don't use uniquePairs here because we know that the pairs list is
-	 * already sorted and uniq'ed.
+	 * we don't use hstoreUniquePairs here because we know that the pairs list
+	 * is already sorted and uniq'ed.
 	 */
 
 	out = hstorePairs(out_pairs, out_count, bufsiz);
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 718f07f4f6..e4ad1919fe 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -3165,8 +3165,8 @@ l2:
 			 * Note that the multixact may not be done by now.  It could have
 			 * surviving members; our own xact or other subxacts of this
 			 * backend, and also any other concurrent transaction that locked
-			 * the tuple with KeyShare if we only got TupleLockUpdate.  If
-			 * this is the case, we have to be careful to mark the updated
+			 * the tuple with KeyShare if we only got LockTupleNoKeyExclusive.
+			 * If this is the case, we have to be careful to mark the updated
 			 * tuple with the surviving members in Xmax.
 			 *
 			 * Note that there could have been another update in the
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 5b759ec7f3..b18eee42d4 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -488,7 +488,7 @@ ForceTransactionIdLimitUpdate(void)
 	if (!TransactionIdIsValid(xidVacLimit))
 		return true;			/* this shouldn't happen anymore either */
 	if (TransactionIdFollowsOrEquals(nextXid, xidVacLimit))
-		return true;			/* past VacLimit, don't delay updating */
+		return true;			/* past xidVacLimit, don't delay updating */
 	if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(oldestXidDB)))
 		return true;			/* could happen, per comments above */
 	return false;
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index b35043bf71..4795c6fa94 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -267,7 +267,7 @@ pg_stop_backup_v2(PG_FUNCTION_ARGS)
 	values[0] = LSNGetDatum(stoppoint);
 
 	tuplestore_putvalues(tupstore, tupdesc, values, nulls);
-	tuplestore_donestoring(typstore);
+	tuplestore_donestoring(tupstore);
 
 	return (Datum) 0;
 }
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 5fa3d7323e..409f787ac3 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -3368,7 +3368,7 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
 
 
 /*
- * Check whether the TransactionOid 'xid' is in the pre-sorted array 'xip'.
+ * Check whether the TransactionId 'xid' is in the pre-sorted array 'xip'.
  */
 static bool
 TransactionIdInArray(TransactionId xid, TransactionId *xip, Size num)
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index ec8fbb9a7d..8079b13ba5 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -1997,7 +1997,7 @@ array_get_element_expanded(Datum arraydatum,
 
 /*
  * array_get_slice :
- *		   This routine takes an array and a range of indices (upperIndex and
+ *		   This routine takes an array and a range of indices (upperIndx and
  *		   lowerIndx), creates a new array structure for the referred elements
  *		   and returns a pointer to it.
  *
diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h
index b3bbb903fc..f724ecf9ca 100644
--- a/src/bin/pg_upgrade/pg_upgrade.h
+++ b/src/bin/pg_upgrade/pg_upgrade.h
@@ -15,9 +15,6 @@
 /* Use port in the private/dynamic port number range */
 #define DEF_PGUPORT			50432
 
-/* Allocate for null byte */
-#define USER_NAME_SIZE		128
-
 #define MAX_STRING			1024
 #define QUERY_ALLOC			8192
 
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index bbba48bc8b..b04f7ec123 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -317,8 +317,8 @@ pqParseInput3(PGconn *conn)
 					 *
 					 * If we're doing a Describe, we have to pass something
 					 * back to the client, so set up a COMMAND_OK result,
-					 * instead of TUPLES_OK.  Otherwise we can just ignore
-					 * this message.
+					 * instead of PGRES_TUPLES_OK.  Otherwise we can just
+					 * ignore this message.
 					 */
 					if (conn->queryclass == PGQUERY_DESCRIBE)
 					{
diff --git a/src/test/isolation/specs/freeze-the-dead.spec b/src/test/isolation/specs/freeze-the-dead.spec
index e24d7d5d11..8c3649902a 100644
--- a/src/test/isolation/specs/freeze-the-dead.spec
+++ b/src/test/isolation/specs/freeze-the-dead.spec
@@ -42,7 +42,7 @@ step "s3_key_share"	{ SELECT id FROM tab_freeze WHERE id = 3 FOR KEY SHARE; }
 step "s3_commit"	{ COMMIT; }
 step "s3_vacuum"	{ VACUUM FREEZE tab_freeze; }
 
-# This permutation verfies that a previous bug
+# This permutation verifies that a previous bug
 #     https://postgr.es/m/E5711E62-8FDF-4DCA-A888-C200BF6B5742@amazon.com
 #     https://postgr.es/m/20171102112019.33wb7g5wp4zpjelu@alap3.anarazel.de
 # is not reintroduced. We used to make wrong pruning / freezing
diff --git a/src/test/isolation/specs/read-only-anomaly-3.spec b/src/test/isolation/specs/read-only-anomaly-3.spec
index 58a159a949..d43fc2e03f 100644
--- a/src/test/isolation/specs/read-only-anomaly-3.spec
+++ b/src/test/isolation/specs/read-only-anomaly-3.spec
@@ -2,7 +2,7 @@
 # isolation"[1].
 #
 # Here we test that serializable snapshot isolation can avoid the anomaly
-# without aborting any tranasctions, by instead causing s3 to be deferred
+# without aborting any transactions, by instead causing s3 to be deferred
 # until a safe snapshot can be taken.
 #
 # [1] http://www.cs.umb.edu/~poneil/ROAnom.pdf
