Re: Support TZ format code in to_timestamp()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Daniel Gustafsson <daniel(at)yesql(dot)se>, Peter Smith <smithpb2250(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>
Subject: Re: Support TZ format code in to_timestamp()
Date: 2024-01-23 22:33:34
Message-ID: 4183414.1706049214@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Aleksander Alekseev <aleksander(at)timescale(dot)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

Attachment Content-Type Size
v2-0001-Support-timezone-abbreviations-in-to_timestamp.patch text/x-diff 22.0 KB
v2-0002-Respond-to-review-comments.patch text/x-diff 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tristan Partin 2024-01-23 23:26:19 Re: Remove pthread_is_threaded_np() checks in postmaster
Previous Message Andres Freund 2024-01-23 22:23:47 Re: Remove pthread_is_threaded_np() checks in postmaster