diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2019-09-16 21:02:14 +0300 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2019-09-16 21:14:32 +0300 |
commit | d589f94460c24d9b7ac21887d031818d6e3f354d (patch) | |
tree | 7aa11a30c7b97403b337691763fd689cd1be0afb /src/test/regress/expected/timestamptz.out | |
parent | d8122578098d3ff20a9a12d25807e56cecac673c (diff) | |
download | postgresql-d589f94460c24d9b7ac21887d031818d6e3f354d.tar.gz |
Support for FF1-FF6 datetime format patterns
SQL Standard 2016 defines FF1-FF9 format patters for fractions of seconds in
jsonpath .datetime() method and CAST (... FORMAT ...) SQL clause. Parsing
engine of upcoming .datetime() method will be shared with to_date()/
to_timestamp().
This patch implements FF1-FF6 format patterns for upcoming jsonpath .datetime()
method. to_date()/to_timestamp() functions will also get support of this
format patterns as positive side effect. FF7-FF9 are not supported due to
lack of precision in our internal timestamp representation.
Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov.
Heavily revised by me.
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com
Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com
Author: Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov
Reviewed-by: Anastasia Lubennikova, Peter Eisentraut
Diffstat (limited to 'src/test/regress/expected/timestamptz.out')
-rw-r--r-- | src/test/regress/expected/timestamptz.out | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/regress/expected/timestamptz.out b/src/test/regress/expected/timestamptz.out index 5551fa6610..2d6a71ca64 100644 --- a/src/test/regress/expected/timestamptz.out +++ b/src/test/regress/expected/timestamptz.out @@ -1704,6 +1704,21 @@ SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') | 2001 1 1 1 1 1 1 (66 rows) +SELECT '' AS to_char_12, to_char(d, 'FF1 FF2 FF3 FF4 FF5 FF6 ff1 ff2 ff3 ff4 ff5 ff6 MS US') + FROM (VALUES + ('2018-11-02 12:34:56'::timestamptz), + ('2018-11-02 12:34:56.78'), + ('2018-11-02 12:34:56.78901'), + ('2018-11-02 12:34:56.78901234') + ) d(d); + to_char_12 | to_char +------------+-------------------------------------------------------------------- + | 0 00 000 0000 00000 000000 0 00 000 0000 00000 000000 000 000000 + | 7 78 780 7800 78000 780000 7 78 780 7800 78000 780000 780 780000 + | 7 78 789 7890 78901 789010 7 78 789 7890 78901 789010 789 789010 + | 7 78 789 7890 78901 789012 7 78 789 7890 78901 789012 789 789012 +(4 rows) + -- Check OF, TZH, TZM with various zone offsets, particularly fractional hours SET timezone = '00:00'; SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; |