On Thu, May 2, 2019 at 1:03 AM Arthur Zakirov <a.zaki...@postgrespro.ru> wrote: > On Thu, May 2, 2019 at 12:49 AM Alexander Korotkov > <a.korot...@postgrespro.ru> wrote: > > Actually, FX takes effect on subsequent format patterns. This is not > > documented, but it copycats Oracle behavior. Sure, normally FX should > > be specified as the first item. We could document current behavior or > > restrict specifying FX not as first item. This is also not new in 12, > > so documenting current behavior is better for compatibility. > > I went to Oracle's documentation. It seems that the behavior is > slightly different. > Their documentation says: > > "A modifier can appear in a format model more than once. In such a case, > each subsequent occurrence toggles the effects of the modifier. Its effects > are > enabled for the portion of the model following its first occurrence, and then > disabled for the portion following its second, and then reenabled for > the portion > following its third, and so on."
What about the patch I attached? It fixes the explanation of FX option a little. -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index d751766004..118da982ee 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -6381,8 +6381,10 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); <literal>to_timestamp('2000 - JUN', 'YYYY-MON')</literal> work, but <literal>to_timestamp('2000 JUN', 'FXYYYY MON')</literal> returns an error because <function>to_timestamp</function> expects only a single space. - <literal>FX</literal> must be specified as the first item in - the template. + <literal>FX</literal> option occurrence enables exact matching mode for + the remaining input string. It can appear in a template string more than + once, but multiple occurrences don't make sense because each of them + doesn't toggle exact matching mode. </para> </listitem>