diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c
index 2152d8ee577..aa9cccd1da4 100644
--- a/contrib/amcheck/verify_heapam.c
+++ b/contrib/amcheck/verify_heapam.c
@@ -460,7 +460,7 @@ verify_heapam(PG_FUNCTION_ARGS)
 	else
 	{
 		/*
-		 * It would not be safe to naively use use batchmode, as
+		 * It would not be safe to naively use batchmode, as
 		 * heapcheck_read_stream_next_unskippable takes locks. It shouldn't be
 		 * too hard to convert though.
 		 */
diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c
index 6bfb9fb669e..4b007f6e1b0 100644
--- a/contrib/pg_buffercache/pg_buffercache_pages.c
+++ b/contrib/pg_buffercache/pg_buffercache_pages.c
@@ -450,8 +450,8 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS)
 		 * locks, so the information of each buffer is self-consistent.
 		 *
 		 * This loop touches and stores addresses into os_page_ptrs[] as input
-		 * to one big big move_pages(2) inquiry system call. Basically we ask
-		 * for all memory pages for NBuffers.
+		 * to one big move_pages(2) inquiry system call. Basically we ask for
+		 * all memory pages for NBuffers.
 		 */
 		startptr = (char *) TYPEALIGN_DOWN(os_page_size, (char *) BufferGetBlock(1));
 		idx = 0;
diff --git a/src/backend/access/nbtree/nbtpreprocesskeys.c b/src/backend/access/nbtree/nbtpreprocesskeys.c
index 4f525f7b26f..1cc99e6cdf2 100644
--- a/src/backend/access/nbtree/nbtpreprocesskeys.c
+++ b/src/backend/access/nbtree/nbtpreprocesskeys.c
@@ -2051,7 +2051,7 @@ _bt_preprocess_array_keys_final(IndexScanDesc scan, int *keyDataMap)
  * the scan's BTArrayKeyInfo array, which is guaranteed to be large enough to
  * fit every so->arrayKeys[] entry.
  *
- * Also sets *numSkipArrayKeys_out to the number of of skip arrays caller must
+ * Also sets *numSkipArrayKeys_out to the number of skip arrays caller must
  * add to the scan keys it'll output.  Caller must add this many skip arrays:
  * one array for each of the most significant attributes that lack a = input
  * key (IS NULL keys count as = input keys here).  The specific attributes
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index 9e27302fe81..8b025796127 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -2597,7 +2597,7 @@ _bt_set_startikey(IndexScanDesc scan, BTReadPageState *pstate)
 			continue;
 		}
 
-		/* Some = key (could be a a scalar = key, could be an array = key) */
+		/* Some = key (could be a scalar = key, could be an array = key) */
 		Assert(key->sk_strategy == BTEqualStrategyNumber);
 
 		if (!(key->sk_flags & SK_SEARCHARRAY))
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index 9435cc21fe7..3f8a4cb5244 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -1983,8 +1983,8 @@ ExecInitPartitionExecPruning(PlanState *planstate,
 	 * account for any that were removed due to initial pruning; refer to the
 	 * condition in InitExecPartitionPruneContexts() that is used to determine
 	 * whether to do this.  If no exec pruning needs to be done, we would thus
-	 * leave the maps to be in an invalid invalid state, but that's ok since
-	 * that data won't be consulted again (cf initial Assert in
+	 * leave the maps to be in an invalid state, but that's ok since that data
+	 * won't be consulted again (cf initial Assert in
 	 * ExecFindMatchingSubPlans).
 	 */
 	if (prunestate->do_exec_prune)
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index ab6317de5ae..a858f27cadc 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -551,7 +551,7 @@ PGLC_localeconv(void)
 			 "could not get lconv for LC_MONETARY = \"%s\", LC_NUMERIC = \"%s\": %m",
 			 locale_monetary, locale_numeric);
 
-	/* Must copy data now now so we can re-encode it. */
+	/* Must copy data now so we can re-encode it. */
 	extlconv = &tmp;
 	worklconv.decimal_point = strdup(extlconv->decimal_point);
 	worklconv.thousands_sep = strdup(extlconv->thousands_sep);
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index 468d0250b2e..68f1cbcf9c2 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -1478,7 +1478,7 @@ ProcessGetMemoryContextInterrupt(void)
 								   summary);
 
 	/*
-	 * Allocate memory in this process's DSA for storing statistics of the the
+	 * Allocate memory in this process's DSA for storing statistics of the
 	 * memory contexts upto max_stats, for contexts that don't fit within a
 	 * limit, a cumulative total is written as the last record in the DSA
 	 * segment.
@@ -1488,8 +1488,8 @@ ProcessGetMemoryContextInterrupt(void)
 	LWLockAcquire(&memCxtArea->lw_lock, LW_EXCLUSIVE);
 
 	/*
-	 * Create a DSA and send handle to the the client process after storing
-	 * the context statistics. If number of contexts exceed a predefined
+	 * Create a DSA and send handle to the client process after storing the
+	 * context statistics. If number of contexts exceed a predefined
 	 * limit(8MB), a cumulative total is stored for such contexts.
 	 */
 	if (memCxtArea->memstats_dsa_handle == DSA_HANDLE_INVALID)
diff --git a/src/bin/pg_upgrade/relfilenumber.c b/src/bin/pg_upgrade/relfilenumber.c
index 79bc474a0bb..2959c07f0b8 100644
--- a/src/bin/pg_upgrade/relfilenumber.c
+++ b/src/bin/pg_upgrade/relfilenumber.c
@@ -424,8 +424,8 @@ swap_catalog_files(FileNameMap *maps, int size, const char *old_catalog_dir,
 		 * stage of pg_upgrade in swap mode, so we need to synchronize them
 		 * ourselves.  We only do this for the catalog files because they were
 		 * created during pg_restore with fsync=off.  We assume that the user
-		 * data files files were properly persisted to disk when the user last
-		 * shut it down.
+		 * data files were properly persisted to disk when the user last shut
+		 * it down.
 		 */
 		if (user_opts.do_sync)
 			sync_queue_push(dest);
diff --git a/src/include/storage/aio.h b/src/include/storage/aio.h
index 9fe9d9ad9fa..f3726bc3dc5 100644
--- a/src/include/storage/aio.h
+++ b/src/include/storage/aio.h
@@ -159,7 +159,7 @@ struct PgAioTargetInfo
 {
 	/*
 	 * To support executing using worker processes, the file descriptor for an
-	 * IO may need to be be reopened in a different process.
+	 * IO may need to be reopened in a different process.
 	 */
 	void		(*reopen) (PgAioHandle *ioh);
 
