diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index d728bd70b3..95dbe8b06c 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -5016,7 +5016,7 @@ postgresGetAnalyzeInfoForForeignTable(Relation relation, bool *can_tablesample)
 			pgfdw_report_error(ERROR, res, conn, false, sql.data);
 
 		if (PQntuples(res) != 1 || PQnfields(res) != 2)
-			elog(ERROR, "unexpected result from deparseAnalyzeTuplesSql query");
+			elog(ERROR, "unexpected result from deparseAnalyzeInfoSql query");
 		reltuples = strtod(PQgetvalue(res, 0, 0), NULL);
 		relkind = *(PQgetvalue(res, 0, 1));
 	}
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 7d3b20168a..f6c0c5ca1a 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -6272,7 +6272,7 @@ ProcessGUCArray(ArrayType *array, ArrayType *usersetArray,
 			userSetDatum = BoolGetDatum(false);
 
 		/*
-		 * USER SET values are appliciable only for PGC_USERSET parameters. We
+		 * USER SET values are applicable only for PGC_USERSET parameters. We
 		 * use InvalidOid as role in order to evade possible privileges of the
 		 * current user.
 		 */
diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c
index 3894a017f3..104c01d966 100644
--- a/src/backend/utils/misc/ps_status.c
+++ b/src/backend/utils/misc/ps_status.c
@@ -87,7 +87,7 @@ static size_t ps_buffer_cur_len;	/* nominal strlen(ps_buffer) */
 static size_t ps_buffer_fixed_size; /* size of the constant prefix */
 
 /*
- * Length of ps_buffer before the suffix was appeneded to the end, or 0 if we
+ * Length of ps_buffer before the suffix was appended to the end, or 0 if we
  * didn't set a suffix.
  */
 static size_t ps_buffer_nosuffix_len;
diff --git a/src/bin/pg_dump/compress_lz4.c b/src/bin/pg_dump/compress_lz4.c
index 5aca9c1f06..423e1b7976 100644
--- a/src/bin/pg_dump/compress_lz4.c
+++ b/src/bin/pg_dump/compress_lz4.c
@@ -342,7 +342,7 @@ LZ4Stream_get_error(CompressFileHandle *CFH)
 /*
  * Initialize an already alloc'ed LZ4State struct for subsequent calls.
  *
- * Creates the necessary contexts for either compresion or decompression. When
+ * Creates the necessary contexts for either compression or decompression. When
  * compressing data (indicated by compressing=true), it additionally writes the
  * LZ4 header in the output stream.
  *
diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h
index 395abfe596..656a2e9897 100644
--- a/src/include/utils/tuplesort.h
+++ b/src/include/utils/tuplesort.h
@@ -146,7 +146,7 @@ typedef int (*SortTupleComparator) (const SortTuple *a, const SortTuple *b,
 
 /*
  * The public part of a Tuple sort operation state.  This data structure
- * containsthe  definition of sort-variant-specific interface methods and
+ * contains the definition of sort-variant-specific interface methods and
  * the part of Tuple sort operation state required by their implementations.
  */
 typedef struct
@@ -189,7 +189,7 @@ typedef struct
 	 * Function to do some specific release of resources for the sort variant.
 	 * In particular, this function should free everything stored in the "arg"
 	 * field, which wouldn't be cleared on reset of the Tuple sort memory
-	 * contextes.  This can be NULL if nothing specific needs to be done.
+	 * contexts.  This can be NULL if nothing specific needs to be done.
 	 */
 	void		(*freestate) (Tuplesortstate *state);
 
diff --git a/src/interfaces/libpq/t/004_load_balance_dns.pl b/src/interfaces/libpq/t/004_load_balance_dns.pl
index f914916dd2..8347eea161 100644
--- a/src/interfaces/libpq/t/004_load_balance_dns.pl
+++ b/src/interfaces/libpq/t/004_load_balance_dns.pl
@@ -16,7 +16,7 @@ if ($ENV{PG_TEST_EXTRA} !~ /\bload_balance\b/)
 # for different IPs. Since setting up a DNS server is more effort than we
 # consider reasonable to run this test, this situation is instead immitated by
 # using a hosts file where a single hostname maps to multiple different IP
-# addresses. This test requires the adminstrator to add the following lines to
+# addresses. This test requires the administrator to add the following lines to
 # the hosts file (if we detect that this hasn't happend we skip the test):
 #
 # 127.0.0.1 pg-loadbalancetest
@@ -24,7 +24,7 @@ if ($ENV{PG_TEST_EXTRA} !~ /\bload_balance\b/)
 # 127.0.0.3 pg-loadbalancetest
 #
 # Windows or Linux are required to run this test because these OSes allow
-# binding to 127.0.0.2 and 127.0.0.3 addresess by default, but other OSes
+# binding to 127.0.0.2 and 127.0.0.3 addresses by default, but other OSes
 # don't. We need to bind to different IP addresses, so that we can use these
 # different IP addresses in the hosts file.
 #
diff --git a/src/test/ldap/LdapServer.pm b/src/test/ldap/LdapServer.pm
index 8c69f660f5..f46271af60 100644
--- a/src/test/ldap/LdapServer.pm
+++ b/src/test/ldap/LdapServer.pm
@@ -19,7 +19,7 @@ LdapServer - class for an LDAP server for testing pg_hba.conf authentication
 
   use LdapServer;
 
-  # have we found openldap binaies suitable for setting up a server?
+  # have we found openldap binaries suitable for setting up a server?
   my $ldap_binaries_found = $LdapServer::setup;
 
   # create a server with the given root password and auth type
diff --git a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
index d767e284a2..60fc9416f9 100644
--- a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
+++ b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
@@ -68,7 +68,7 @@ use Test::More;
 
 =over
 
-=item PostgreSQL::Test::BackroundPsql->new(interactive, @params)
+=item PostgreSQL::Test::BackgroundPsql->new(interactive, @params)
 
 Builds a new object of class C<PostgreSQL::Test::BackgroundPsql> for either
 an interactive or background session and starts it. If C<interactive> is
