commit c716d5ccdf9e768d7ab9dc100fff43bf1ea06c6c
Author: Alexander Korotkov <akorotkov@postgresql.org>
Date:   Sat Sep 22 21:51:44 2018 +0300

    Documentation about letters/digits in to_date()/to_timestamp()

diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index c44417d868d..dce81eecf89 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -6296,6 +6296,35 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
       </para>
      </listitem>
 
+     <listitem>
+      <para>
+        Template string can contain letters/digits, which are not part of some
+        template pattern.  Such template string letters/digits mach any
+        characters in input string including letters and digits.
+        For example, <literal>to_timestamp('2000yJUN', 'YYYYxMON')</literal>
+        works.
+      </para>
+      <para>
+        Without the <literal>FX</literal> option, spaces are skipped in the
+        beginning of the input string and around date and time values.  In order
+        to prevent template string letters/digits from consuming data and time
+        values characters followed by spaces, they do consume character only
+        when number of characters after previous value (or beginning of the
+        string) in input string is less or equal than number of such
+        characters in template string.  For example,
+        <literal>to_timestamp('2000y JUN', 'YYYYxMON')</literal> works, but
+        <literal>to_timestamp('2000 yJUN', 'YYYYxMON')</literal> returns an
+        error.
+      </para>
+      <para>
+        In spite of letters, digits in template string can prevent previous
+        template pattern from being greedy.  For example,
+        <literal>to_timestamp('2000906901', 'YYYY0MM0DD')</literal> works, but
+        <literal>to_timestamp('2000906901', 'YYYYxMMxDD')</literal> returns an
+        error.
+      </para>
+     </listitem>
+
      <listitem>
       <para>
        <literal>TZH</literal> template pattern can match a signed number.
