Commit ad23adc5 authored by Bruce Momjian's avatar Bruce Momjian

doc: improve PG 12 to_timestamp()/to_date() wording

parent 34547386
...@@ -6388,7 +6388,7 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); ...@@ -6388,7 +6388,7 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
<listitem> <listitem>
<para> <para>
A separator (a space or a non-letter/non-digit character) in the template string of A separator (a space or non-letter/non-digit character) in the template string of
<function>to_timestamp</function> and <function>to_date</function> <function>to_timestamp</function> and <function>to_date</function>
matches any single separator in the input string or is skipped, matches any single separator in the input string or is skipped,
unless the <literal>FX</literal> option is used. unless the <literal>FX</literal> option is used.
...@@ -6399,22 +6399,22 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); ...@@ -6399,22 +6399,22 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
exceeds the number of separators in the template. exceeds the number of separators in the template.
</para> </para>
<para> <para>
If <literal>FX</literal> is specified, separator in template string If <literal>FX</literal> is specified, a separator in the template string
matches to exactly one character in input string. Notice we don't insist matches exactly one character in input string. Notice we don't insist the
input string character to be the same as template string separator. input string character be the same as the template string separator.
For example, <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal> For example, <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal>
works, but <literal>to_timestamp('2000/JUN', 'FXYYYY&nbsp;&nbsp;MON')</literal> works, but <literal>to_timestamp('2000/JUN', 'FXYYYY&nbsp;&nbsp;MON')</literal>
returns an error because a space second template string space consumed returns an error because the second template string space is consumed
letter <literal>J</literal> from the input string. by the letter <literal>J</literal> in the input string.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
<literal>TZH</literal> template pattern can match a signed number. A <literal>TZH</literal> template pattern can match a signed number.
Without the <literal>FX</literal> option, it may lead to ambiguity in Without the <literal>FX</literal> option, it can lead to ambiguity in
interpretation of the minus sign, which can also be interpreted as a separator. interpretation of the minus sign, which can also be interpreted as a separator.
This ambiguity is resolved as follows. If the number of separators before This ambiguity is resolved as follows: If the number of separators before
<literal>TZH</literal> in the template string is less than the number of <literal>TZH</literal> in the template string is less than the number of
separators before the minus sign in the input string, the minus sign separators before the minus sign in the input string, the minus sign
is interpreted as part of <literal>TZH</literal>. is interpreted as part of <literal>TZH</literal>.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment