commit c716d5ccdf9e768d7ab9dc100fff43bf1ea06c6c Author: Alexander Korotkov 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}'); + + + 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, to_timestamp('2000yJUN', 'YYYYxMON') + works. + + + Without the FX 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, + to_timestamp('2000y JUN', 'YYYYxMON') works, but + to_timestamp('2000 yJUN', 'YYYYxMON') returns an + error. + + + In spite of letters, digits in template string can prevent previous + template pattern from being greedy. For example, + to_timestamp('2000906901', 'YYYY0MM0DD') works, but + to_timestamp('2000906901', 'YYYYxMMxDD') returns an + error. + + + TZH template pattern can match a signed number.