Re: Support TZ format code in to_timestamp()
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Aleksander Alekseev <aleksander@timescale.com>
Cc: pgsql-hackers@lists.postgresql.org, Daniel Gustafsson <daniel@yesql.se>,
Peter Smith <smithpb2250@gmail.com>,
David Steele <david@pgmasters.net>
Date: 2024-01-23T22:33:34Z
Lists: pgsql-hackers
Attachments
- v2-0001-Support-timezone-abbreviations-in-to_timestamp.patch (text/x-diff) patch v2-0001
- v2-0002-Respond-to-review-comments.patch (text/x-diff) patch v2-0002
Aleksander Alekseev <aleksander@timescale.com> writes:
> I reviewed the patch and tested it on MacOS and generally concur with
> stated above. The only nitpick I have is the apparent lack of negative
> tests for to_timestamp(), e.g. when the string doesn't match the
> specified format.
That's an excellent suggestion indeed, because when I tried
SELECT to_timestamp('2011-12-18 11:38 JUNK', 'YYYY-MM-DD HH12:MI TZ'); -- error
I got
ERROR: invalid value "JU" for "TZ"
DETAIL: Value must be an integer.
which seems pretty off-point. In the attached I made it give an
error message about a bad zone abbreviation if the input starts
with a letter, but perhaps the dividing line between "probably
meant as a zone name" and "probably meant as numeric" should be
drawn differently?
Anyway, v2-0001 below is the previous patch rebased up to current
(only line numbers change), and then v2-0002 responds to your
and Daniel's review comments.
regards, tom lane
Commits
-
Support TZ and OF format codes in to_timestamp().
- 8ba6fdf905d0 17.0 landed