diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2024-01-25 17:47:08 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2024-01-25 17:47:08 -0500 |
commit | 8ba6fdf905d0f5aef70ced4504c6ad297bfe08ea (patch) | |
tree | 58e63620c2de356734338912a082e930fd1d6e3e /doc/src | |
parent | 06a66d87dbc7e06581af6765131ea250063fb4ac (diff) | |
download | postgresql-8ba6fdf905d0f5aef70ced4504c6ad297bfe08ea.tar.gz postgresql-8ba6fdf905d0f5aef70ced4504c6ad297bfe08ea.zip |
Support TZ and OF format codes in to_timestamp().
Formerly, these were only supported in to_char(), but there seems
little reason for that restriction. We should at least have enough
support to permit round-tripping the output of to_char().
In that spirit, TZ accepts either zone abbreviations or numeric
(HH or HH:MM) offsets, which are the cases that to_char() can output.
In an ideal world we'd make it take full zone names too, but
that seems like it'd introduce an unreasonable amount of ambiguity,
since the rules for POSIX-spec zone names are so lax.
OF is a subset of this, accepting only HH or HH:MM.
One small benefit of this improvement is that we can simplify
jsonpath's executeDateTimeMethod function, which no longer needs
to consider the HH and HH:MM cases separately. Moreover, letting
it accept zone abbreviations means it will accept "Z" to mean UTC,
which is emitted by JSON.stringify() for example.
Patch by me, reviewed by Aleksander Alekseev and Daniel Gustafsson
Discussion: https://postgr.es/m/1681086.1686673242@sss.pgh.pa.us
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 4f7195c5082..6788ba8ef4a 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -8131,13 +8131,11 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); </row> <row> <entry><literal>TZ</literal></entry> - <entry>upper case time-zone abbreviation - (only supported in <function>to_char</function>)</entry> + <entry>upper case time-zone abbreviation</entry> </row> <row> <entry><literal>tz</literal></entry> - <entry>lower case time-zone abbreviation - (only supported in <function>to_char</function>)</entry> + <entry>lower case time-zone abbreviation</entry> </row> <row> <entry><literal>TZH</literal></entry> @@ -8149,8 +8147,8 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); </row> <row> <entry><literal>OF</literal></entry> - <entry>time-zone offset from UTC - (only supported in <function>to_char</function>)</entry> + <entry>time-zone offset from UTC (<replaceable>HH</replaceable> + or <replaceable>HH</replaceable><literal>:</literal><replaceable>MM</replaceable>)</entry> </row> </tbody> </tgroup> |