diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c
index 5fbd253491a5835bda0dfa423e2b343fd00da77d..40398245f6d0e8b80366b9bd7dc2ecad650ce3c2 100644
--- a/contrib/isn/isn.c
+++ b/contrib/isn/isn.c
@@ -511,7 +511,7 @@ str2ean(const char *num)
 }
 
 /*
- * ean2string --- Try to convert an ean13 number to an hyphenated string.
+ * ean2string --- Try to convert an ean13 number to a hyphenated string.
  *				  Assumes there's enough space in result to hold
  *				  the string (maximum MAXEAN13LEN+1 bytes)
  *				  This doesn't verify for a valid check digit.
diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c
index 98016fc365e71dbc5f04303f9f46cbebb49ebbdb..761c277c63be169f907aea827965b7c63f7ef297 100644
--- a/contrib/pg_buffercache/pg_buffercache_pages.c
+++ b/contrib/pg_buffercache/pg_buffercache_pages.c
@@ -142,7 +142,7 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
 			LWLockAcquire(BufMappingPartitionLockByIndex(i), LW_SHARED);
 
 		/*
-		 * Scan though all the buffers, saving the relevant fields in the
+		 * Scan through all the buffers, saving the relevant fields in the
 		 * fctx->record structure.
 		 */
 		for (i = 0; i < NBuffers; i++)
diff --git a/contrib/spi/timetravel.c b/contrib/spi/timetravel.c
index e125986c2b31dc9823e3a13a6a340b4430eb2349..5a345841c6a9cbc3dbfa83b5a34b8ab6e3083915 100644
--- a/contrib/spi/timetravel.c
+++ b/contrib/spi/timetravel.c
@@ -51,7 +51,7 @@ static EPlan *find_plan(char *ident, EPlan **eplan, int *nplans);
  *			and all other column values as in new tuple, and insert tuple
  *			with old data and stop_date eq current date
  *			ELSE - skip updation of tuple.
- *		2.  IF an delete affects tuple with stop_date eq INFINITY
+ *		2.  IF a delete affects tuple with stop_date eq INFINITY
  *			then insert the same tuple with stop_date eq current date
  *			[ and delete_user eq current user ]
  *			ELSE - skip deletion of tuple.
diff --git a/contrib/test_decoding/expected/decoding_in_xact.out b/contrib/test_decoding/expected/decoding_in_xact.out
index 456840886aabf31af0451857dfe0c1c05765caa2..ab4d3aee723db94cc39c0d190a25db514855a56b 100644
--- a/contrib/test_decoding/expected/decoding_in_xact.out
+++ b/contrib/test_decoding/expected/decoding_in_xact.out
@@ -11,7 +11,7 @@ SELECT txid_current() = 0;
 SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
 ERROR:  cannot create logical replication slot in transaction that has performed writes
 ROLLBACK;
--- fail because we're creating a slot while in an subxact whose topxact has a xid
+-- fail because we're creating a slot while in a subxact whose topxact has an xid
 BEGIN;
 SELECT txid_current() = 0;
  ?column? 
diff --git a/contrib/test_decoding/specs/ondisk_startup.spec b/contrib/test_decoding/specs/ondisk_startup.spec
index 39c4a223aeeb24e0e8dac9452455bd656eee5f12..8223705639200584ac58243daacbf4779d31ac21 100644
--- a/contrib/test_decoding/specs/ondisk_startup.spec
+++ b/contrib/test_decoding/specs/ondisk_startup.spec
@@ -36,7 +36,7 @@ step "s3txid" { BEGIN ISOLATION LEVEL REPEATABLE READ; SELECT txid_current() IS
 step "s3c" { COMMIT; }
 
 # Force usage of ondisk snapshot by starting and not finishing a
-# transaction with a assigned xid after consistency has been
+# transaction with an assigned xid after consistency has been
 # reached. In combination with a checkpoint forcing a snapshot to be
 # written and a new restart point computed that'll lead to the usage
 # of the snapshot.
diff --git a/contrib/test_decoding/sql/decoding_in_xact.sql b/contrib/test_decoding/sql/decoding_in_xact.sql
index 990f61885e7f0443c7482df2832e4035d0f66d1b..b524eb9a6e01fe22698ec6573ec3c19ba4ff70ad 100644
--- a/contrib/test_decoding/sql/decoding_in_xact.sql
+++ b/contrib/test_decoding/sql/decoding_in_xact.sql
@@ -7,7 +7,7 @@ SELECT txid_current() = 0;
 SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
 ROLLBACK;
 
--- fail because we're creating a slot while in an subxact whose topxact has a xid
+-- fail because we're creating a slot while in a subxact whose topxact has an xid
 BEGIN;
 SELECT txid_current() = 0;
 SAVEPOINT barf;
diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml
index eff52cb1e0c8f4250b27180edeca17217be86f32..3c3315eab3d6806f384a0d10b64b200147498905 100644
--- a/doc/src/sgml/ref/insert.sgml
+++ b/doc/src/sgml/ref/insert.sgml
@@ -415,7 +415,7 @@ INSERT INTO <replaceable class="PARAMETER">table_name</replaceable> [ AS <replac
    one or more <replaceable
    class="PARAMETER">column_name_index</replaceable> columns and/or
    <replaceable class="PARAMETER">expression_index</replaceable>
-   expressions, and a optional <replaceable class="PARAMETER">
+   expressions, and an optional <replaceable class="PARAMETER">
    index_predicate</replaceable>.
   </para>
 
diff --git a/src/backend/access/brin/brin_pageops.c b/src/backend/access/brin/brin_pageops.c
index acb64bde4fc35e53cc5198eb061351d0ac827d1a..4e37ccbe9e974875f46df7d2d94e91b0e4b4ba11 100644
--- a/src/backend/access/brin/brin_pageops.c
+++ b/src/backend/access/brin/brin_pageops.c
@@ -492,7 +492,7 @@ brin_evacuate_page(Relation idxRel, BlockNumber pagesPerRange,
 /*
  * Return a pinned and exclusively locked buffer which can be used to insert an
  * index item of size itemsz.  If oldbuf is a valid buffer, it is also locked
- * (in a order determined to avoid deadlocks.)
+ * (in an order determined to avoid deadlocks.)
  *
  * If there's no existing page with enough free space to accomodate the new
  * item, the relation is extended.  If this happens, *extended is set to true.
diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c
index 5b6aa93e2c5987bd828a64f330a870e364d30390..3f92c56d3c0fe7a0c9616741b6d8c447e1c2979c 100644
--- a/src/backend/access/gin/ginbtree.c
+++ b/src/backend/access/gin/ginbtree.c
@@ -313,7 +313,7 @@ ginFindParents(GinBtree btree, GinBtreeStack *stack)
  * the parent needs to be updated. (a root split returns true as it doesn't
  * need any further action by the caller to complete)
  *
- * When inserting a downlink to a internal page, 'childbuf' contains the
+ * When inserting a downlink to an internal page, 'childbuf' contains the
  * child page that was split. Its GIN_INCOMPLETE_SPLIT flag will be cleared
  * atomically with the insert. Also, the existing item at the given location
  * is updated to point to 'updateblkno'.
diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c
index bea7055604fee07588815f0fce1b04d8f0e2b8ef..ea85c4e2c0351ca5c5a3cb6422fc54cd191de2b1 100644
--- a/src/backend/access/gin/ginxlog.c
+++ b/src/backend/access/gin/ginxlog.c
@@ -409,7 +409,7 @@ ginRedoSplit(XLogReaderState *record)
 
 /*
  * VACUUM_PAGE record contains simply a full image of the page, similar to
- * a XLOG_FPI record.
+ * an XLOG_FPI record.
  */
 static void
 ginRedoVacuumPage(XLogReaderState *record)
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index c30a5b3cd1d1d11c9ae1f42e62154c09fc3f242e..cb86a4fa3e6a73ef5cbdb164a7b5b82307fce47e 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -5107,7 +5107,7 @@ l5:
 /*
  * Subroutine for heap_lock_updated_tuple_rec.
  *
- * Given an hypothetical multixact status held by the transaction identified
+ * Given a hypothetical multixact status held by the transaction identified
  * with the given xid, does the current transaction need to wait, fail, or can
  * it continue if it wanted to acquire a lock of the given mode?  "needwait"
  * is set to true if waiting is necessary; if it can continue, then
@@ -7139,7 +7139,7 @@ log_heap_update(Relation reln, Buffer oldbuf,
 }
 
 /*
- * Perform XLogInsert of a XLOG_HEAP2_NEW_CID record
+ * Perform XLogInsert of an XLOG_HEAP2_NEW_CID record
  *
  * This is only used in wal_level >= WAL_LEVEL_LOGICAL, and only for catalog
  * tuples.
@@ -7179,7 +7179,7 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
 		 *
 		 * We need to check for LOCK ONLY because multixacts might be
 		 * transferred to the new tuple in case of FOR KEY SHARE updates in
-		 * which case there will be a xmax, although the tuple just got
+		 * which case there will be an xmax, although the tuple just got
 		 * inserted.
 		 */
 		if (hdr->t_infomask & HEAP_XMAX_INVALID ||
@@ -7217,7 +7217,7 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
  * Build a heap tuple representing the configured REPLICA IDENTITY to represent
  * the old tuple in a UPDATE or DELETE.
  *
- * Returns NULL if there's no need to log a identity or if there's no suitable
+ * Returns NULL if there's no need to log an identity or if there's no suitable
  * key in the Relation relation.
  */
 static HeapTuple
diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c
index af5c158fc68984a776065be05b46a7d4ccf07ea4..bcce3e35d5eb8a4fff8142774d6cb2810121a8bc 100644
--- a/src/backend/access/heap/rewriteheap.c
+++ b/src/backend/access/heap/rewriteheap.c
@@ -195,7 +195,7 @@ typedef struct
 typedef OldToNewMappingData *OldToNewMapping;
 
 /*
- * In-Memory data for a xid that might need logical remapping entries
+ * In-Memory data for an xid that might need logical remapping entries
  * to be logged.
  */
 typedef struct RewriteMappingFile
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index fcb614b942795f107fc9153fac81efafb17be9e1..cfb1d64f86aed34a0a3103df15d886d080612c2f 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -118,7 +118,7 @@ _bt_search(Relation rel, int keysz, ScanKey scankey, bool nextkey,
 		 * In write-mode, allow _bt_moveright to finish any incomplete splits
 		 * along the way.  Strictly speaking, we'd only need to finish an
 		 * incomplete split on the leaf page we're about to insert to, not on
-		 * any of the upper levels (they is taken care of in _bt_getstackbuf,
+		 * any of the upper levels (they are taken care of in _bt_getstackbuf,
 		 * if the leaf page is split and we insert to the parent page).  But
 		 * this is a good opportunity to finish splits of internal pages too.
 		 */
diff --git a/src/backend/access/rmgrdesc/xactdesc.c b/src/backend/access/rmgrdesc/xactdesc.c
index cac1df8e07a7a98eecb351c9bd5e62b71af30e78..793f9bb51fa82bcc3933eee13412e2a0d3dde2fe 100644
--- a/src/backend/access/rmgrdesc/xactdesc.c
+++ b/src/backend/access/rmgrdesc/xactdesc.c
@@ -21,7 +21,7 @@
 #include "utils/timestamp.h"
 
 /*
- * Parse the WAL format of a xact commit and abort records into a easier to
+ * Parse the WAL format of an xact commit and abort records into an easier to
  * understand format.
  *
  * This routines are in xactdesc.c because they're accessed in backend (when
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 40042a5fd5328ccf236597e68c4184fc32dfbdb0..63344327e3d1dfb0edbd609b10c39f562996e06f 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -122,7 +122,7 @@ static void WriteSetTimestampXlogRec(TransactionId mainxid, int nsubxids,
  * subtrans implementation changes in the future, we might want to revisit the
  * decision of storing timestamp info for each subxid.
  *
- * The do_xlog parameter tells us whether to include a XLog record of this
+ * The do_xlog parameter tells us whether to include an XLog record of this
  * or not.  Normal path through RecordTransactionCommit() will be related
  * to a transaction commit XLog record, and so should pass "false" here.
  * Other callers probably want to pass true, so that the given values persist
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index f6009e07473a32f081c4c07632ecb887b4768151..62f00455e1b408fe306a6290241aed97d42ad460 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -221,7 +221,7 @@ static TransactionStateData TopTransactionStateData = {
 
 /*
  * unreportedXids holds XIDs of all subtransactions that have not yet been
- * reported in a XLOG_XACT_ASSIGNMENT record.
+ * reported in an XLOG_XACT_ASSIGNMENT record.
  */
 static int	nUnreportedXids;
 static TransactionId unreportedXids[PGPROC_MAX_CACHED_SUBXIDS];
@@ -532,7 +532,7 @@ AssignTransactionId(TransactionState s)
 	/*
 	 * When wal_level=logical, guarantee that a subtransaction's xid can only
 	 * be seen in the WAL stream if its toplevel xid has been logged before.
-	 * If necessary we log a xact_assignment record with fewer than
+	 * If necessary we log an xact_assignment record with fewer than
 	 * PGPROC_MAX_CACHED_SUBXIDS. Note that it is fine if didLogXid isn't set
 	 * for a transaction even though it appears in a WAL record, we just might
 	 * superfluously log something. That can happen when an xid is included
@@ -1232,8 +1232,8 @@ RecordTransactionCommit(void)
 	 * Check if we want to commit asynchronously.  We can allow the XLOG flush
 	 * to happen asynchronously if synchronous_commit=off, or if the current
 	 * transaction has not performed any WAL-logged operation or didn't assign
-	 * a xid.  The transaction can end up not writing any WAL, even if it has
-	 * a xid, if it only wrote to temporary and/or unlogged tables.  It can
+	 * an xid.  The transaction can end up not writing any WAL, even if it has
+	 * an xid, if it only wrote to temporary and/or unlogged tables.  It can
 	 * end up having written WAL without an xid if it did HOT pruning.  In
 	 * case of a crash, the loss of such a transaction will be irrelevant;
 	 * temp tables will be lost anyway, unlogged tables will be truncated and
@@ -1305,7 +1305,7 @@ RecordTransactionCommit(void)
 	/*
 	 * Wait for synchronous replication, if required. Similar to the decision
 	 * above about using committing asynchronously we only want to wait if
-	 * this backend assigned a xid and wrote WAL.  No need to wait if a xid
+	 * this backend assigned an xid and wrote WAL.  No need to wait if an xid
 	 * was assigned due to temporary/unlogged tables or due to HOT pruning.
 	 *
 	 * Note that at this stage we have marked clog, but still show as running
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index b203b82899a8aa21ba2b9b242cbd2049905d2652..4af8fdc3642b2aa6ff3f26793b924ff7c0c84f69 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8832,7 +8832,7 @@ CreateRestartPoint(int flags)
 	}
 
 	/*
-	 * Due to an historical accident multixact truncations are not WAL-logged,
+	 * Due to a historical accident multixact truncations are not WAL-logged,
 	 * but just performed everytime the mxact horizon is increased. So, unless
 	 * we explicitly execute truncations on a standby it will never clean out
 	 * /pg_multixact which obviously is bad, both because it uses space and
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index fa2aa27eff347af6c7d21aff5201e393e422f639..81ccebf3c94afcb8394450d6db29e74d7b5c350d 100644
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -117,7 +117,7 @@ IsCatalogClass(Oid relid, Form_pg_class reltuple)
 	 * We could instead check whether the relation is pinned in pg_depend, but
 	 * this is noticeably cheaper and doesn't require catalog access.
 	 *
-	 * This test is safe since even a oid wraparound will preserve this
+	 * This test is safe since even an oid wraparound will preserve this
 	 * property (c.f. GetNewObjectId()) and it has the advantage that it works
 	 * correctly even if a user decides to create a relation in the pg_catalog
 	 * namespace.
diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c
index ce398fca89949ae1298407f0d7a0b17d2a790231..d4440c9d1dbeb47235eb8362233b1c034f1dcf62 100644
--- a/src/backend/catalog/storage.c
+++ b/src/backend/catalog/storage.c
@@ -119,7 +119,7 @@ RelationCreateStorage(RelFileNode rnode, char relpersistence)
 }
 
 /*
- * Perform XLogInsert of a XLOG_SMGR_CREATE record to WAL.
+ * Perform XLogInsert of an XLOG_SMGR_CREATE record to WAL.
  */
 void
 log_smgrcreate(RelFileNode *rnode, ForkNumber forkNum)
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 00a2417a099ea7d1da3b6bf43f6297a8ef71b096..3e14c536e2152645b3f70b52418e72b506456b0c 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -3346,7 +3346,7 @@ CopyReadLineText(CopyState cstate)
 			 * just use the char as a toggle. If they are different, we need
 			 * to ensure that we only take account of an escape inside a
 			 * quoted field and immediately preceding a quote char, and not
-			 * the second in a escape-escape sequence.
+			 * the second in an escape-escape sequence.
 			 */
 			if (in_quote && c == escapec)
 				last_was_esc = !last_was_esc;
diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c
index 7658c06d53448fa23948daec422ac4c268a2dcee..43aeac50853203c745dfd419f0c6ef3f10dcb322 100644
--- a/src/backend/commands/event_trigger.c
+++ b/src/backend/commands/event_trigger.c
@@ -1771,7 +1771,7 @@ EventTriggerCollectAlterTableSubcmd(Node *subcmd, ObjectAddress address)
  * EventTriggerAlterTableEnd
  *		Finish up saving an ALTER TABLE command, and add it to command list.
  *
- * FIXME this API isn't considering the possibility that a xact/subxact is
+ * FIXME this API isn't considering the possibility that an xact/subxact is
  * aborted partway through.  Probably it's best to add an
  * AtEOSubXact_EventTriggers() to fix this.
  */
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 80f5553d3a41a127bcb62547516c58a873ef546a..bb85cb9f13fd6ea4a520ccc71e1e05d96fa3e591 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -703,8 +703,8 @@ nextval_internal(Oid relid)
 	/*
 	 * If something needs to be WAL logged, acquire an xid, so this
 	 * transaction's commit will trigger a WAL flush and wait for
-	 * syncrep. It's sufficient to ensure the toplevel transaction has a xid,
-	 * no need to assign xids subxacts, that'll already trigger a appropriate
+	 * syncrep. It's sufficient to ensure the toplevel transaction has an xid,
+	 * no need to assign xids subxacts, that'll already trigger an appropriate
 	 * wait.  (Have to do that here, so we're outside the critical section)
 	 */
 	if (logit && RelationNeedsWAL(seqrel))
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 33ea387d62feff59196bc9fde9ca6b179b48d682..5114e6f1a4d49e1a5b5856773e04e63e7e625a7c 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -2342,7 +2342,7 @@ RangeVarCallbackForRenameAttribute(const RangeVar *rv, Oid relid, Oid oldrelid,
 }
 
 /*
- *		renameatt		- changes the name of a attribute in a relation
+ *		renameatt		- changes the name of an attribute in a relation
  *
  * The returned ObjectAddress is that of the renamed column.
  */
diff --git a/src/backend/executor/execIndexing.c b/src/backend/executor/execIndexing.c
index e7cf72b38755ab253e3ecd4d6429388abbea70fd..ee1cd19f96b4543aa07ab2174cf4f3c9a76c4a91 100644
--- a/src/backend/executor/execIndexing.c
+++ b/src/backend/executor/execIndexing.c
@@ -53,7 +53,7 @@
  * Speculative insertion
  * ---------------------
  *
- * Speculative insertion is a is a two-phase mechanism, used to implement
+ * Speculative insertion is a two-phase mechanism used to implement
  * INSERT ... ON CONFLICT DO UPDATE/NOTHING.  The tuple is first inserted
  * to the heap and update the indexes as usual, but if a constraint is
  * violated, we can still back out the insertion without aborting the whole
diff --git a/src/backend/optimizer/README b/src/backend/optimizer/README
index 6cae9e8b48935a112975673fbfc36e669b663ab3..d51fd5751694483be898a657ffd6ef2d2d584938 100644
--- a/src/backend/optimizer/README
+++ b/src/backend/optimizer/README
@@ -656,7 +656,7 @@ EquivalenceClasses and PathKeys after query_planner has completed.
 In these cases, the extra ECs/PKs are needed to represent sort orders
 that were not considered during query_planner.  Such situations should be
 minimized since it is impossible for query_planner to return a plan
-producing such a sort order, meaning a explicit sort will always be needed.
+producing such a sort order, meaning an explicit sort will always be needed.
 Currently this happens only for queries involving multiple window functions
 with different orderings, for which extra sorts are needed anyway.
 
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 976ca029c551d271db33a482ffad8de6d5484c89..9da544453b665f82772e520e8159298f8ad1b732 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -3968,7 +3968,7 @@ prefix_quals(Node *leftop, Oid opfamily, Oid collation,
 }
 
 /*
- * Given a leftop and a rightop, and a inet-family sup/sub operator,
+ * Given a leftop and a rightop, and an inet-family sup/sub operator,
  * generate suitable indexqual condition(s).  expr_op is the original
  * operator, and opfamily is the index opfamily.
  */
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 709f3fb7c3318d78308190a932133f356dec5468..db6c6f7c23a5cf6cbf30988e255512be7f0517fd 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -9484,8 +9484,8 @@ InsertStmt:
 
 /*
  * Can't easily make AS optional here, because VALUES in insert_rest would
- * have a shift/reduce conflict with a values as a optional alias. We could
- * easily allow unreserved_keywords as optional aliases, but that'd be a odd
+ * have a shift/reduce conflict with a values as an optional alias. We could
+ * easily allow unreserved_keywords as optional aliases, but that'd be an odd
  * divergance from other places.  So just require AS for now.
  */
 insert_target:
diff --git a/src/backend/port/atomics.c b/src/backend/port/atomics.c
index f57e6723017560147d1348efe2161191a5c51b53..263c68f466246b7595a6ca1f2c57470c6a29796c 100644
--- a/src/backend/port/atomics.c
+++ b/src/backend/port/atomics.c
@@ -52,7 +52,7 @@ pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
 #ifndef HAVE_SPINLOCKS
 	/*
 	 * NB: If we're using semaphore based TAS emulation, be careful to use a
-	 * separate set of semaphores. Otherwise we'd get in trouble if a atomic
+	 * separate set of semaphores. Otherwise we'd get in trouble if an atomic
 	 * var would be manipulated while spinlock is held.
 	 */
 	s_init_lock_sema((slock_t *) &ptr->sema, true);
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index b341ff64d9e276101d06d25a61d1270fab916969..89e8cf073a83704fdc97004f00d259d59736dec4 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -443,7 +443,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
 			/*
 			 * Mark file as archived, otherwise files can get archived again
 			 * after promotion of a new node. This is in line with
-			 * walreceiver.c always doing a XLogArchiveForceDone() after a
+			 * walreceiver.c always doing an XLogArchiveForceDone() after a
 			 * complete segment.
 			 */
 			StatusFilePath(pathbuf, walFiles[i], ".done");
diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c
index 45d143686aca7e33bf91293bb9735997d55d5997..ed78e36192a61269c14116e3e2b86e916d1d1846 100644
--- a/src/backend/replication/logical/logical.c
+++ b/src/backend/replication/logical/logical.c
@@ -149,7 +149,7 @@ StartupDecodingContext(List *output_plugin_options,
 	 * replication slots.
 	 *
 	 * We can only do so if we're outside of a transaction (i.e. the case when
-	 * streaming changes via walsender), otherwise a already setup
+	 * streaming changes via walsender), otherwise an already setup
 	 * snapshot/xid would end up being ignored. That's not a particularly
 	 * bothersome restriction since the SQL interface can't be used for
 	 * streaming anyway.
@@ -225,7 +225,7 @@ CreateInitDecodingContext(char *plugin,
 
 	/* first some sanity checks that are unlikely to be violated */
 	if (slot == NULL)
-		elog(ERROR, "cannot perform logical decoding without a acquired slot");
+		elog(ERROR, "cannot perform logical decoding without an acquired slot");
 
 	if (plugin == NULL)
 		elog(ERROR, "cannot initialize logical decoding without a specified plugin");
@@ -377,7 +377,7 @@ CreateDecodingContext(XLogRecPtr start_lsn,
 
 	/* first some sanity checks that are unlikely to be violated */
 	if (slot == NULL)
-		elog(ERROR, "cannot perform logical decoding without a acquired slot");
+		elog(ERROR, "cannot perform logical decoding without an acquired slot");
 
 	/* make sure the passed slot is suitable, these are user facing errors */
 	if (slot->data.database == InvalidOid)
@@ -436,7 +436,7 @@ CreateDecodingContext(XLogRecPtr start_lsn,
 }
 
 /*
- * Returns true if an consistent initial decoding snapshot has been built.
+ * Returns true if a consistent initial decoding snapshot has been built.
  */
 bool
 DecodingContextReady(LogicalDecodingContext *ctx)
diff --git a/src/backend/replication/logical/logicalfuncs.c b/src/backend/replication/logical/logicalfuncs.c
index 3be5263c3f9f81611ca99c28b8cd1034b25619eb..021de837bed1bb23fb83821e2166c13966f4849c 100644
--- a/src/backend/replication/logical/logicalfuncs.c
+++ b/src/backend/replication/logical/logicalfuncs.c
@@ -53,7 +53,7 @@ typedef struct DecodingOutputState
 } DecodingOutputState;
 
 /*
- * Prepare for a output plugin write.
+ * Prepare for an output plugin write.
  */
 static void
 LogicalOutputPrepareWrite(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xid,
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 57854b0aa5780547ba0cf1c73998033ae943518f..5b407aadef6738e5b512333d06c4a76dff21b863 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -286,7 +286,7 @@ ReorderBufferFree(ReorderBuffer *rb)
 }
 
 /*
- * Get a unused, possibly preallocated, ReorderBufferTXN.
+ * Get an unused, possibly preallocated, ReorderBufferTXN.
  */
 static ReorderBufferTXN *
 ReorderBufferGetTXN(ReorderBuffer *rb)
@@ -361,7 +361,7 @@ ReorderBufferReturnTXN(ReorderBuffer *rb, ReorderBufferTXN *txn)
 }
 
 /*
- * Get a unused, possibly preallocated, ReorderBufferChange.
+ * Get an unused, possibly preallocated, ReorderBufferChange.
  */
 ReorderBufferChange *
 ReorderBufferGetChange(ReorderBuffer *rb)
@@ -444,7 +444,7 @@ ReorderBufferReturnChange(ReorderBuffer *rb, ReorderBufferChange *change)
 
 
 /*
- * Get a unused, possibly preallocated, ReorderBufferTupleBuf
+ * Get an unused, possibly preallocated, ReorderBufferTupleBuf
  */
 ReorderBufferTupleBuf *
 ReorderBufferGetTupleBuf(ReorderBuffer *rb)
@@ -1531,7 +1531,7 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,
 		}
 
 		/*
-		 * There's a a speculative insertion remaining, just clean in up, it
+		 * There's a speculative insertion remaining, just clean in up, it
 		 * can't have been successful, otherwise we'd gotten a confirmation
 		 * record.
 		 */
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index ea25cf050cf75d5816279b18760e0c823b710776..37476caed9b0ff94eaee6b69b75e90d29018314e 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -79,7 +79,7 @@
  *	  +--->|SNAPBUILD_CONSISTENT	 |<------------+
  *		   +-------------------------+
  *
- * Initially the machinery is in the START stage. When a xl_running_xacts
+ * Initially the machinery is in the START stage. When an xl_running_xacts
  * record is read that is sufficiently new (above the safe xmin horizon),
  * there's a state transition. If there were no running xacts when the
  * runnign_xacts record was generated, we'll directly go into CONSISTENT
@@ -161,7 +161,7 @@ struct SnapBuild
 
 	/*
 	 * Don't start decoding WAL until the "xl_running_xacts" information
-	 * indicates there are no running xids with a xid smaller than this.
+	 * indicates there are no running xids with an xid smaller than this.
 	 */
 	TransactionId initial_xmin_horizon;
 
@@ -683,8 +683,9 @@ SnapBuildProcessChange(SnapBuild *builder, TransactionId xid, XLogRecPtr lsn)
 }
 
 /*
- * Do CommandId/ComboCid handling after reading a xl_heap_new_cid record. This
- * implies that a transaction has done some form of write to system catalogs.
+ * Do CommandId/ComboCid handling after reading an xl_heap_new_cid record.
+ * This implies that a transaction has done some form of write to system
+ * catalogs.
  */
 void
 SnapBuildProcessNewCid(SnapBuild *builder, TransactionId xid,
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index d2e184237462eb81db949a82d4b494c31f110e79..79c7791b1f4ea8d36c520a3ace43f7544321aa5c 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -437,7 +437,7 @@ ReplicationSlotDropAcquired(void)
 	/*
 	 * Rename the slot directory on disk, so that we'll no longer recognize
 	 * this as a valid slot.  Note that if this fails, we've got to mark the
-	 * slot inactive before bailing out.  If we're dropping a ephemeral slot,
+	 * slot inactive before bailing out.  If we're dropping an ephemeral slot,
 	 * we better never fail hard as the caller won't expect the slot to
 	 * survive and this might get called during error handling.
 	 */
@@ -546,7 +546,7 @@ ReplicationSlotMarkDirty(void)
 
 /*
  * Convert a slot that's marked as RS_EPHEMERAL to a RS_PERSISTENT slot,
- * guaranteeing it will be there after a eventual crash.
+ * guaranteeing it will be there after an eventual crash.
  */
 void
 ReplicationSlotPersist(void)
diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c
index 0cd2530be99032feae6d917daf453fd70e7158eb..ef1f9a6900830bdc4ed69e58735731428a7db7e5 100644
--- a/src/backend/storage/buffer/buf_init.c
+++ b/src/backend/storage/buffer/buf_init.c
@@ -50,7 +50,7 @@ char	   *BufferBlocks;
  * refcount --	Counts the number of processes holding pins on a buffer.
  *		A buffer is pinned during IO and immediately after a BufferAlloc().
  *		Pins must be released before end of transaction.  For efficiency the
- *		shared refcount isn't increased if a individual backend pins a buffer
+ *		shared refcount isn't increased if an individual backend pins a buffer
  *		multiple times. Check the PrivateRefCount infrastructure in bufmgr.c.
  */
 
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index a68eae81695f3f3b711d35d6c910e46b031f1cbc..2e6e0ca6cd342e7a257dbbc0ad6e376233238ca1 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -101,13 +101,13 @@ static volatile BufferDesc *PinCountWaitBuf = NULL;
  * Each buffer also has a private refcount that keeps track of the number of
  * times the buffer is pinned in the current process.  This is so that the
  * shared refcount needs to be modified only once if a buffer is pinned more
- * than once by a individual backend.  It's also used to check that no buffers
+ * than once by an individual backend.  It's also used to check that no buffers
  * are still pinned at the end of transactions and when exiting.
  *
  *
  * To avoid - as we used to - requiring an array with NBuffers entries to keep
  * track of local buffers, we use a small sequentially searched array
- * (PrivateRefCountArray) and a overflow hash table (PrivateRefCountHash) to
+ * (PrivateRefCountArray) and an overflow hash table (PrivateRefCountHash) to
  * keep track of backend local pins.
  *
  * Until no more than REFCOUNT_ARRAY_ENTRIES buffers are pinned at once, all
diff --git a/src/backend/storage/buffer/freelist.c b/src/backend/storage/buffer/freelist.c
index f0d23d68582d01c9133bcee8ce3c84e4a60c1c69..c36e80af23ade6bd4d1882518b4843b0ef308627 100644
--- a/src/backend/storage/buffer/freelist.c
+++ b/src/backend/storage/buffer/freelist.c
@@ -149,7 +149,7 @@ ClockSweepTick(void)
 				 * allows other readers to read nextVictimBuffer and
 				 * completePasses in a consistent manner which is required for
 				 * StrategySyncStart().  In theory delaying the increment
-				 * could lead to a overflow of nextVictimBuffers, but that's
+				 * could lead to an overflow of nextVictimBuffers, but that's
 				 * highly unlikely and wouldn't be particularly harmful.
 				 */
 				SpinLockAcquire(&StrategyControl->buffer_strategy_lock);
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 68cc6edd09205374af72cf189c8d6e728e92bd92..b4b4613a8c422fca6e04a0853392a164033684ae 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -287,7 +287,7 @@ ProcArrayAdd(PGPROC *proc)
 	/*
 	 * Keep the procs array sorted by (PGPROC *) so that we can utilize
 	 * locality of references much better. This is useful while traversing the
-	 * ProcArray because there is a increased likelihood of finding the next
+	 * ProcArray because there is an increased likelihood of finding the next
 	 * PGPROC structure in the cache.
 	 *
 	 * Since the occurrence of adding/removing a proc is much lower than the
@@ -2061,7 +2061,7 @@ GetOldestSafeDecodingTransactionId(void)
  * the result is somewhat indeterminate, but we don't really care.  Even in
  * a multiprocessor with delayed writes to shared memory, it should be certain
  * that setting of delayChkpt will propagate to shared memory when the backend
- * takes a lock, so we cannot fail to see an virtual xact as delayChkpt if
+ * takes a lock, so we cannot fail to see a virtual xact as delayChkpt if
  * it's already inserted its commit record.  Whether it takes a little while
  * for clearing of delayChkpt to propagate is unimportant for correctness.
  */
@@ -3500,7 +3500,7 @@ KnownAssignedXidsRemovePreceding(TransactionId removeXid)
 
 	/*
 	 * Mark entries invalid starting at the tail.  Since array is sorted, we
-	 * can stop as soon as we reach a entry >= removeXid.
+	 * can stop as soon as we reach an entry >= removeXid.
 	 */
 	tail = pArray->tailKnownAssignedXids;
 	head = pArray->headKnownAssignedXids;
diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c
index 67ec5152a84bd621a1e0b59d6738f58bd0911523..7c95f4c6a954f065a54671c7417273d8976008dc 100644
--- a/src/backend/storage/ipc/sinval.c
+++ b/src/backend/storage/ipc/sinval.c
@@ -33,7 +33,7 @@ uint64		SharedInvalidMessageCounter;
  * through a cache reset exercise.  This is done by sending
  * PROCSIG_CATCHUP_INTERRUPT to any backend that gets too far behind.
  *
- * The signal handler will set a interrupt pending flag and will set the
+ * The signal handler will set an interrupt pending flag and will set the
  * processes latch. Whenever starting to read from the client, or when
  * interrupted while doing so, ProcessClientReadInterrupt() will call
  * ProcessCatchupEvent().
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index 01e03f0e8427fe14c105af38d06b58d38d6c4320..bad5618341e3995e538edefd17561cf6db33721e 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -62,7 +62,7 @@
  *		an existing SIREAD lock for the same transaction, the SIREAD lock
  *		can be deleted.
  *
- * (7)	A write from a serializable transaction must ensure that a xact
+ * (7)	A write from a serializable transaction must ensure that an xact
  *		record exists for the transaction, with the same lifespan (until
  *		all concurrent transaction complete or the transaction is rolled
  *		back) so that rw-dependencies to that transaction can be
@@ -4745,7 +4745,7 @@ AtPrepare_PredicateLocks(void)
 	if (MySerializableXact == InvalidSerializableXact)
 		return;
 
-	/* Generate a xact record for our SERIALIZABLEXACT */
+	/* Generate an xact record for our SERIALIZABLEXACT */
 	record.type = TWOPHASEPREDICATERECORD_XACT;
 	xactRecord->xmin = MySerializableXact->xmin;
 	xactRecord->flags = MySerializableXact->flags;
diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c
index 1c036d5d384a0b4c8566b111e7d1ddb4058ac1ed..a2f0f5cebd370a06fb995cb1f9c2d7790ab8d5f4 100644
--- a/src/backend/tsearch/spell.c
+++ b/src/backend/tsearch/spell.c
@@ -1335,7 +1335,7 @@ CheckAffix(const char *word, size_t len, AFFIX *Affix, int flagflags, char *neww
 	else
 	{
 		/*
-		 * if prefix is a all non-chaged part's length then all word contains
+		 * if prefix is an all non-changed part's length then all word contains
 		 * only prefix and suffix, so out
 		 */
 		if (baselen && *baselen + strlen(Affix->find) <= Affix->replen)
diff --git a/src/backend/utils/adt/array_selfuncs.c b/src/backend/utils/adt/array_selfuncs.c
index 6cd28c8c53263731c8a2fcd50bf679646fb9c517..9d023c2621a29162f96b86186bba6fe4117eedfa 100644
--- a/src/backend/utils/adt/array_selfuncs.c
+++ b/src/backend/utils/adt/array_selfuncs.c
@@ -300,7 +300,7 @@ arraycontsel(PG_FUNCTION_ARGS)
 
 	/*
 	 * OK, there's a Var and a Const we're dealing with here.  We need the
-	 * Const to be a array with same element type as column, else we can't do
+	 * Const to be an array with same element type as column, else we can't do
 	 * anything useful.  (Such cases will likely fail at runtime, but here
 	 * we'd rather just return a default estimate.)
 	 */
@@ -358,7 +358,7 @@ calc_arraycontsel(VariableStatData *vardata, Datum constval,
 	cmpfunc = &typentry->cmp_proc_finfo;
 
 	/*
-	 * The caller made sure the const is a array with same element type, so
+	 * The caller made sure the const is an array with same element type, so
 	 * get it now
 	 */
 	array = DatumGetArrayTypeP(constval);
diff --git a/src/backend/utils/adt/array_typanalyze.c b/src/backend/utils/adt/array_typanalyze.c
index 742f94d92aa3732a3a032fbdf8cb34cebe95f91f..ffe8035eb4d53a4266f8e0738a1b6bc25b0e3dd0 100644
--- a/src/backend/utils/adt/array_typanalyze.c
+++ b/src/backend/utils/adt/array_typanalyze.c
@@ -157,7 +157,7 @@ array_typanalyze(PG_FUNCTION_ARGS)
 }
 
 /*
- * compute_array_stats() -- compute statistics for a array column
+ * compute_array_stats() -- compute statistics for an array column
  *
  * This function computes statistics useful for determining selectivity of
  * the array operators <@, &&, and @>.  It is invoked by ANALYZE via the
diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c
index 6aba20de85185fdc0e1dfd3defa2cd9c0b741e2c..b336185df7e16439e61f990789569b5ac4bbd01b 100644
--- a/src/backend/utils/adt/cash.c
+++ b/src/backend/utils/adt/cash.c
@@ -893,7 +893,7 @@ cashsmaller(PG_FUNCTION_ARGS)
 }
 
 /* cash_words()
- * This converts a int4 as well but to a representation using words
+ * This converts an int4 as well but to a representation using words
  * Obviously way North American centric - sorry
  */
 Datum
diff --git a/src/backend/utils/adt/rangetypes_selfuncs.c b/src/backend/utils/adt/rangetypes_selfuncs.c
index a130b483f3c58ee465715b78dd1aea8d6151016e..7cc5e484366ee0070bfc0b5700d0cce5a3dea3cb 100644
--- a/src/backend/utils/adt/rangetypes_selfuncs.c
+++ b/src/backend/utils/adt/rangetypes_selfuncs.c
@@ -596,8 +596,8 @@ calc_hist_selectivity_scalar(TypeCacheEntry *typcache, RangeBound *constbound,
  * range bounds in array are greater or equal(greater) than given range bound,
  * return -1. When "equal" flag is set conditions in brackets are used.
  *
- * This function is used in scalar operators selectivity estimation. Another
- * goal of this function is to found an histogram bin where to stop
+ * This function is used in scalar operator selectivity estimation. Another
+ * goal of this function is to find a histogram bin where to stop
  * interpolation of portion of bounds which are less or equal to given bound.
  */
 static int
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 7e5598d53cc917bff029d9cc3903574a7adef5a8..f27131edd1679cef8971344521be32a3b124a8ab 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -440,7 +440,7 @@ format_procedure_internal(Oid procedure_oid, bool force_qualify)
 }
 
 /*
- * Output a objname/objargs representation for the procedure with the
+ * Output an objname/objargs representation for the procedure with the
  * given OID.  If it doesn't exist, an error is thrown.
  *
  * This can be used to feed get_object_address.
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index 86a014a2bbc58542d6f966929bdae7189ab38e34..dae929a24c88a669c8409d5b658dac2d96486cdc 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -1963,7 +1963,7 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
 
 
 /* interval2tm()
- * Convert a interval data type to a tm structure.
+ * Convert an interval data type to a tm structure.
  */
 int
 interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec)
@@ -2907,7 +2907,7 @@ interval_justify_days(PG_FUNCTION_ARGS)
 }
 
 /* timestamp_pl_interval()
- * Add a interval to a timestamp data type.
+ * Add an interval to a timestamp data type.
  * Note that interval has provisions for qualitative year/month and day
  *	units, so try to do the right thing with them.
  * To add a month, increment the month, and use the same day of month.
@@ -3007,7 +3007,7 @@ timestamp_mi_interval(PG_FUNCTION_ARGS)
 
 
 /* timestamptz_pl_interval()
- * Add a interval to a timestamp with time zone data type.
+ * Add an interval to a timestamp with time zone data type.
  * Note that interval has provisions for qualitative year/month
  *	units, so try to do the right thing with them.
  * To add a month, increment the month, and use the same day of month.
diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c
index 266a728ef6a3e781f6143b2dcb8a933568b3b894..eb15937b3559aff591119f2d8b205fd8263bd0db 100644
--- a/src/backend/utils/adt/tsvector_op.c
+++ b/src/backend/utils/adt/tsvector_op.c
@@ -38,8 +38,8 @@ typedef struct
 
 typedef struct StatEntry
 {
-	uint32		ndoc;			/* zero indicates that we already was here
-								 * while walking throug the tree */
+	uint32		ndoc;			/* zero indicates that we were already here
+								 * while walking through the tree */
 	uint32		nentry;
 	struct StatEntry *left;
 	struct StatEntry *right;
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 18cbdd0e76943debd6ed3d889d04be2095f35b4c..5fd2bef617fc9dd236e09011b48ee7d48e937f01 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -4126,7 +4126,7 @@ array_to_text_internal(FunctionCallInfo fcinfo, ArrayType *v,
 
 #define HEXBASE 16
 /*
- * Convert a int32 to a string containing a base 16 (hex) representation of
+ * Convert an int32 to a string containing a base 16 (hex) representation of
  * the number.
  */
 Datum
@@ -4150,7 +4150,7 @@ to_hex32(PG_FUNCTION_ARGS)
 }
 
 /*
- * Convert a int64 to a string containing a base 16 (hex) representation of
+ * Convert an int64 to a string containing a base 16 (hex) representation of
  * the number.
  */
 Datum
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 5bb03dd0b1ed306437b13330a6c256f5c56e2693..577c0590729ede6554b42611498a5ea2dd034014 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -1123,7 +1123,7 @@ SearchCatCache(CatCache *cache,
 	SysScanDesc scandesc;
 	HeapTuple	ntp;
 
-	/* Make sure we're in a xact, even if this ends up being a cache hit */
+	/* Make sure we're in an xact, even if this ends up being a cache hit */
 	Assert(IsTransactionState());
 
 	/*
diff --git a/src/backend/utils/misc/sampling.c b/src/backend/utils/misc/sampling.c
index c9479ec175e33972e070d7cda7d646b187d494e5..69479a5fc8ca492e2701c53679a2af5ac616614f 100644
--- a/src/backend/utils/misc/sampling.c
+++ b/src/backend/utils/misc/sampling.c
@@ -78,7 +78,7 @@ BlockSampler_Next(BlockSampler bs)
 	 * Knuth says to skip the current block with probability 1 - k/K.
 	 * If we are to skip, we should advance t (hence decrease K), and
 	 * repeat the same probabilistic test for the next block.  The naive
-	 * implementation thus requires an sampler_random_fract() call for each
+	 * implementation thus requires a sampler_random_fract() call for each
 	 * block number.  But we can reduce this to one sampler_random_fract()
 	 * call per selected block, by noting that each time the while-test
 	 * succeeds, we can reinterpret V as a uniform random number in the range
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 7169ad09ccfa75c13a7ff138dc6a48368bdc075e..2c72e19f2d3f096e67b746ab17020f3eb278c02e 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -1734,7 +1734,7 @@ runPgDump(const char *dbname)
 /*
  * buildShSecLabels
  *
- * Build SECURITY LABEL command(s) for an shared object
+ * Build SECURITY LABEL command(s) for a shared object
  *
  * The caller has to provide object type and identifier to select security
  * labels from pg_seclabels system view.
diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h
index c9f20266f86685d14435103e60a9fd8f1a879877..5f214d779ab5d6f2993abaf976b46e9d75c50db3 100644
--- a/src/include/access/gin_private.h
+++ b/src/include/access/gin_private.h
@@ -429,7 +429,7 @@ typedef struct
 	 * whose split this insertion finishes. As BlockIdData[2] (beware of
 	 * adding fields before this that would make them not 16-bit aligned)
 	 *
-	 * 2. an ginxlogInsertEntry or ginxlogRecompressDataLeaf struct, depending
+	 * 2. a ginxlogInsertEntry or ginxlogRecompressDataLeaf struct, depending
 	 * on tree type.
 	 *
 	 * NB: the below structs are only 16-bit aligned when appended to a
diff --git a/src/include/access/rewriteheap.h b/src/include/access/rewriteheap.h
index 4db495ef4187218bc99205eba6abaee73c010882..91f4051d75d4f81f7d6aec32cb571ee3f0bc39ef 100644
--- a/src/include/access/rewriteheap.h
+++ b/src/include/access/rewriteheap.h
@@ -41,7 +41,7 @@ typedef struct LogicalRewriteMappingData
 } LogicalRewriteMappingData;
 
 /* ---
- * The filename consists out of the following, dash separated,
+ * The filename consists of the following, dash separated,
  * components:
  * 1) database oid or InvalidOid for shared relations
  * 2) the oid of the relation
diff --git a/src/include/access/rmgrlist.h b/src/include/access/rmgrlist.h
index 47033da017b1e241d8ec15bad39bf2704d8afda3..c083216265b4cceeeb63d45711fc397c4e258054 100644
--- a/src/include/access/rmgrlist.h
+++ b/src/include/access/rmgrlist.h
@@ -21,7 +21,7 @@
  * entries should be added at the end, to avoid changing IDs of existing
  * entries.
  *
- * Changes to this list possibly need a XLOG_PAGE_MAGIC bump.
+ * Changes to this list possibly need an XLOG_PAGE_MAGIC bump.
  */
 
 /* symbol name, textual name, redo, desc, identify, startup, cleanup */
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 668e987f488c2f3e2d2e5bc0c82345d73ef120f5..a518a8613b3f10ca317a0598b1bdaaa50a5385c5 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -167,7 +167,7 @@ typedef struct xl_xact_assignment
  * portion of the records won't need all possible pieces of information. So we
  * only include what's needed.
  *
- * A minimal commit/abort record only consists out of a xl_xact_commit/abort
+ * A minimal commit/abort record only consists of a xl_xact_commit/abort
  * struct. The presence of additional information is indicated by bits set in
  * 'xl_xact_xinfo->xinfo'. The presence of the xinfo field itself is signalled
  * by a set XLOG_XACT_HAS_INFO bit in the xl_info field.
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index b5b93450ec36dbfb3330ab5b2f11f758f6c12ab2..0405027e01c069521731da367c8146103a78be5b 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -909,11 +909,11 @@ DESCR("larger of two");
 DATA(insert OID = 516 (  array_smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2277 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_smaller _null_ _null_ _null_ ));
 DESCR("smaller of two");
 DATA(insert OID = 3277 (  array_position		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 23 "2277 2283" _null_ _null_ _null_ _null_ _null_ array_position _null_ _null_ _null_ ));
-DESCR("returns a offset of value in array");
+DESCR("returns an offset of value in array");
 DATA(insert OID = 3278 (  array_position		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 23 "2277 2283 23" _null_ _null_ _null_ _null_ _null_ array_position_start _null_ _null_ _null_ ));
-DESCR("returns a offset of value in array with start index");
+DESCR("returns an offset of value in array with start index");
 DATA(insert OID = 3279 (  array_positions		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1007 "2277 2283" _null_ _null_ _null_ _null_ _null_ array_positions _null_ _null_ _null_ ));
-DESCR("returns a array of offsets of some value in array");
+DESCR("returns an array of offsets of some value in array");
 DATA(insert OID = 1191 (  generate_subscripts PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 23 "2277 23 16" _null_ _null_ _null_ _null_ _null_ generate_subscripts _null_ _null_ _null_ ));
 DESCR("array subscripts generator");
 DATA(insert OID = 1192 (  generate_subscripts PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ _null_ generate_subscripts_nodir _null_ _null_ _null_ ));
diff --git a/src/include/port/atomics/generic-gcc.h b/src/include/port/atomics/generic-gcc.h
index c9fc87b30d957e3939a3093d4c50ab3e5c1bac08..591c9fe1eb3efcb4987a04eff991aeb13af6efd0 100644
--- a/src/include/port/atomics/generic-gcc.h
+++ b/src/include/port/atomics/generic-gcc.h
@@ -117,7 +117,7 @@ typedef struct pg_atomic_uint64
 static inline bool
 pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
 {
-	/* NB: only a acquire barrier, not a full one */
+	/* NB: only an acquire barrier, not a full one */
 	/* some platform only support a 1 here */
 	return __sync_lock_test_and_set(&ptr->value, 1) == 0;
 }
diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h
index 928b1ca170f19339d55eff23e332092e1654d4da..666c5f2841964c633d081a45168e6b535c37a7c3 100644
--- a/src/include/replication/reorderbuffer.h
+++ b/src/include/replication/reorderbuffer.h
@@ -245,7 +245,7 @@ typedef struct ReorderBufferTXN
 	/* ---
 	 * Position in one of three lists:
 	 * * list of subtransactions if we are *known* to be subxact
-	 * * list of toplevel xacts (can be a as-yet unknown subxact)
+	 * * list of toplevel xacts (can be am as-yet unknown subxact)
 	 * * list of preallocated ReorderBufferTXNs
 	 * ---
 	 */
diff --git a/src/include/rewrite/prs2lock.h b/src/include/rewrite/prs2lock.h
index dbfb7b015aa4f7829a6aee1209b36ca826ea21f3..06fbc482589e8d8bdd57ff81c2d79dd5c3ead025 100644
--- a/src/include/rewrite/prs2lock.h
+++ b/src/include/rewrite/prs2lock.h
@@ -18,7 +18,7 @@
 
 /*
  * RewriteRule -
- *	  holds a info for a rewrite rule
+ *	  holds an info for a rewrite rule
  *
  */
 typedef struct RewriteRule
diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c
index dce8a14d88ac6f7aa0192dd70838b9c4f89edaa2..01825bd688e2b347ee8984f5f7885d6df71c3758 100644
--- a/src/interfaces/ecpg/pgtypeslib/interval.c
+++ b/src/interfaces/ecpg/pgtypeslib/interval.c
@@ -980,7 +980,7 @@ EncodeInterval(struct /* pg_ */ tm * tm, fsec_t fsec, int style, char *str)
 
 
 /* interval2tm()
- * Convert a interval data type to a tm structure.
+ * Convert an interval data type to a tm structure.
  */
 static int
 interval2tm(interval span, struct tm * tm, fsec_t *fsec)
diff --git a/src/pl/plpython/plpy_procedure.c b/src/pl/plpython/plpy_procedure.c
index 00405f0adac00ac0438cc3b3437e89414d9e331e..d5d44f068496c28e52b09b2fa1911ac9cb009be4 100644
--- a/src/pl/plpython/plpy_procedure.c
+++ b/src/pl/plpython/plpy_procedure.c
@@ -445,7 +445,8 @@ PLy_procedure_argument_valid(PLyTypeInfo *arg)
 
 	/*
 	 * Zero typ_relid means that we got called on an output argument of a
-	 * function returning a unnamed record type; the info for it can't change.
+	 * function returning an unnamed record type; the info for it can't
+	 * change.
 	 */
 	if (!OidIsValid(arg->typ_relid))
 		return true;