diff --git a/doc/src/sgml/bloom.sgml b/doc/src/sgml/bloom.sgml
index 25e0d679a03f08241d156af4762617702ff2cde2..49cb066144c1679194cd61f6b6543a658ca5fc4c 100644
--- a/doc/src/sgml/bloom.sgml
+++ b/doc/src/sgml/bloom.sgml
@@ -20,8 +20,8 @@
    The implementation of a
    <ulink url="http://en.wikipedia.org/wiki/Bloom_filter">Bloom filter</ulink>
    allows fast exclusion of non-candidate tuples via signatures.
-   Since a signature is a lossy representation of all indexed attributes, 
-   search results must be rechecked using heap information. 
+   Since a signature is a lossy representation of all indexed attributes,
+   search results must be rechecked using heap information.
    The user can specify signature length (in uint16, default is 5) and the
    number of bits, which can be set per attribute (1 < colN < 2048).
   </para>
@@ -33,7 +33,7 @@
    possible queries where one needs only a single bloom index.  A Bloom index
    supports only equality comparison.  Since it's a signature file, and not a
    tree, it always must be read fully, but sequentially, so that index search
-   performance is constant and doesn't depend on a query. 
+   performance is constant and doesn't depend on a query.
   </para>
  </sect2>
 
diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml
index decdca25b3e81c3f92b63917bd04d82fcabe5609..5c40168ce85cdee209a2cc15c50d95e7090376c4 100644
--- a/doc/src/sgml/fdwhandler.sgml
+++ b/doc/src/sgml/fdwhandler.sgml
@@ -820,7 +820,7 @@ IterateDirectModify (ForeignScanState *node);
     </para>
 
     <para>
-     Whether the query has the clause or not, the query's reported row count 
+     Whether the query has the clause or not, the query's reported row count
      must be incremented by the FDW itself.  When the query doesn't have the
      clause, the FDW must also increment the row count for the
      <structname>ForeignScanState</> node in the <command>EXPLAIN ANALYZE</>
diff --git a/doc/src/sgml/gin.sgml b/doc/src/sgml/gin.sgml
index b805af5050458e1a4823214ded047e09921540c3..05d92eb97502073dd8a19d44f3d1e79be8928056 100644
--- a/doc/src/sgml/gin.sgml
+++ b/doc/src/sgml/gin.sgml
@@ -734,7 +734,7 @@
    from the indexed item). As of <productname>PostgreSQL</productname> 8.4,
    <acronym>GIN</> is capable of postponing much of this work by inserting
    new tuples into a temporary, unsorted list of pending entries.
-   When the table is vacuumed or autoanalyzed, or when 
+   When the table is vacuumed or autoanalyzed, or when
    <function>gin_clean_pending_list</function> function is called, or if the
    pending list becomes larger than
    <xref linkend="guc-gin-pending-list-limit">, the entries are moved to the
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index 74a6cc0ed72dccd35916ad4cff47e03d918d0a0a..2713883019e1df88a4aafef342b8780b3962c529 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -563,7 +563,7 @@ SELECT datname, age(datfrozenxid) FROM pg_database;
     <command>VACUUM</> normally only scans pages that have been modified
     since the last vacuum, but <structfield>relfrozenxid</> can only be
     advanced when every page of the table
-    that might contain unfrozen XIDs is scanned.  This happens when 
+    that might contain unfrozen XIDs is scanned.  This happens when
     <structfield>relfrozenxid</> is more than
     <varname>vacuum_freeze_table_age</> transactions old, when
     <command>VACUUM</>'s <literal>FREEZE</> option is used, or when all
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml
index 31547b55323358fc97365a6cecf4820fc333bca8..b31f3731e498be8d785b2f78755c106b9316e58a 100644
--- a/doc/src/sgml/postgres-fdw.sgml
+++ b/doc/src/sgml/postgres-fdw.sgml
@@ -304,7 +304,7 @@
      <term><literal>fetch_size</literal></term>
      <listitem>
       <para>
-       This option specifies the number of rows <filename>postgres_fdw</> 
+       This option specifies the number of rows <filename>postgres_fdw</>
        should get in each fetch operation. It can be specified for a foreign
        table or a foreign server. The option specified on a table overrides
        an option specified for the server.
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 01699c61f246752d01637b4d211f364ca4c2dc80..afcc9b7ea5b9169eabe1ac35a45049f6265b0ed7 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -71,7 +71,7 @@ PostgreSQL documentation
    missing files from a WAL archive automatically is currently not supported.
    Besides, <application>pg_rewind</> use cases are not limited by failover.
    For instance, standby server could be promoted, run some writes and
-   then be returned back as standby. 
+   then be returned back as standby.
   </para>
 
   <para>
@@ -134,8 +134,8 @@ PostgreSQL documentation
        <para>
         Specifies a libpq connection string to connect to the source
         <productname>PostgreSQL</> server to synchronize the target with.
-        The connection must be a normal (non-replication) connection 
-        with superuser access. The server must be up and running, 
+        The connection must be a normal (non-replication) connection
+        with superuser access. The server must be up and running,
         and must not be in recovery mode.
        </para>
       </listitem>
diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml
index ee363ef4501c6b34a72d951216fa9ae79c7da414..7c9d8ea44f21d6b193cffa2b975531380dd6e3d6 100644
--- a/doc/src/sgml/ref/pgbench.sgml
+++ b/doc/src/sgml/ref/pgbench.sgml
@@ -1064,8 +1064,8 @@ f(x) = exp(-parameter * (x - min) / (max - min + 1)) / (1 - exp(-parameter))
       function of the standard normal distribution, with mean <literal>mu</>
       defined as <literal>(max + min) / 2.0</>, with
 <literallayout>
- f(x) = PHI(2.0 * parameter * (x - mu) / (max - min + 1)) /
-        (2.0 * PHI(parameter) - 1)
+f(x) = PHI(2.0 * parameter * (x - mu) / (max - min + 1)) /
+       (2.0 * PHI(parameter) - 1)
 </literallayout>
       then value <replaceable>i</> between <replaceable>min</> and
       <replaceable>max</> inclusive is drawn with probability:
@@ -1158,22 +1158,22 @@ END;
   <para>
    Here is a snippet of the log file generated:
 <screen>
- 0 199 2241 0 1175850568 995598
- 0 200 2465 0 1175850568 998079
- 0 201 2513 0 1175850569 608
- 0 202 2038 0 1175850569 2663
+0 199 2241 0 1175850568 995598
+0 200 2465 0 1175850568 998079
+0 201 2513 0 1175850569 608
+0 202 2038 0 1175850569 2663
 </screen>
 
    Another example with --rate=100 and --latency-limit=5 (note the additional
    <replaceable>schedule_lag</> column):
 <screen>
- 0 81 4621 0 1412881037 912698 3005
- 0 82 6173 0 1412881037 914578 4304
- 0 83 skipped 0 1412881037 914578 5217
- 0 83 skipped 0 1412881037 914578 5099
- 0 83 4722 0 1412881037 916203 3108
- 0 84 4142 0 1412881037 918023 2333
- 0 85 2465 0 1412881037 919759 740
+0 81 4621 0 1412881037 912698 3005
+0 82 6173 0 1412881037 914578 4304
+0 83 skipped 0 1412881037 914578 5217
+0 83 skipped 0 1412881037 914578 5099
+0 83 4722 0 1412881037 916203 3108
+0 84 4142 0 1412881037 918023 2333
+0 85 2465 0 1412881037 919759 740
 </screen>
    In this example, transaction 82 was late, because its latency (6.173 ms) was
    over the 5 ms limit. The next two transactions were skipped, because they
diff --git a/doc/src/sgml/ref/pgtesttiming.sgml b/doc/src/sgml/ref/pgtesttiming.sgml
index d5e231fff7bc1f977b9c52be803d8e56d42d6937..f07a0600ff4540a4095aa5fdc1bca1cfa2fe7975 100644
--- a/doc/src/sgml/ref/pgtesttiming.sgml
+++ b/doc/src/sgml/ref/pgtesttiming.sgml
@@ -99,11 +99,11 @@ Testing timing overhead for 3 seconds.
 Per loop time including overhead: 35.96 nsec
 Histogram of timing durations:
 < usec   % of total      count
-     1     96.40465   80435604 
-     2      3.59518    2999652  
-     4      0.00015        126  
-     8      0.00002         13  
-    16      0.00000          2  
+     1     96.40465   80435604
+     2      3.59518    2999652
+     4      0.00015        126
+     8      0.00002         13
+    16      0.00000          2
 </screen>
   </para>
 
@@ -160,11 +160,11 @@ tsc hpet acpi_pm
 Per loop time including overhead: 722.92 nsec
 Histogram of timing durations:
 < usec   % of total      count
-     1     27.84870    1155682 
-     2     72.05956    2990371 
-     4      0.07810       3241  
-     8      0.01357        563  
-    16      0.00007          3  
+     1     27.84870    1155682
+     2     72.05956    2990371
+     4      0.07810       3241
+     8      0.01357        563
+    16      0.00007          3
 </screen>
   </para>
 
@@ -212,12 +212,12 @@ Testing timing overhead for 3 seconds.
 Per timing duration including loop overhead: 97.75 ns
 Histogram of timing durations:
 < usec   % of total      count
-     1     90.23734   27694571 
-     2      9.75277    2993204  
-     4      0.00981       3010  
-     8      0.00007         22  
-    16      0.00000          1  
-    32      0.00000          1  
+     1     90.23734   27694571
+     2      9.75277    2993204
+     4      0.00981       3010
+     8      0.00007         22
+    16      0.00000          1
+    32      0.00000          1
 </screen></para>
 
  </refsect2>
diff --git a/doc/src/sgml/spgist.sgml b/doc/src/sgml/spgist.sgml
index 24c11bae71d75f8863e5911a4dae5095d818bd5d..6a22054ec84c8a1da600d3f782716a10d7b6df0d 100644
--- a/doc/src/sgml/spgist.sgml
+++ b/doc/src/sgml/spgist.sgml
@@ -637,7 +637,7 @@ typedef struct spgInnerConsistentOut
        responsible for palloc'ing the
        <structfield>nodeNumbers</>, <structfield>levelAdds</> and
        <structfield>reconstructedValues</> arrays.
-       Sometimes accumulating some information is needed, while 
+       Sometimes accumulating some information is needed, while
        descending from parent to child node was happened. In this case
        <structfield>traversalValues</> array keeps pointers to
        specific data you need to accumulate for every child node.