Re: Support TZ format code in to_timestamp()

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

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
> On 22 Jan 2024, at 03:10, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> + while (len > 0)
> + {
> + const datetkn *tp = datebsearch(lowtoken, zoneabbrevtbl->abbrevs,
> + zoneabbrevtbl->numabbrevs);

> My immediate reaction was that we should stop at prefix lengths of two since I
> could only think of abbreviations of two or more. Googling and reading found
> that there are indeed one-letter timezones (Alpha, Bravo etc..). Not sure if
> it's worth mentioning that in the comment to help other readers who aren't neck
> deep in timezones?

The one I usually think of is "Z" for UTC; I wasn't actually aware
that there were any other single-letter abbrevs. But in any case
I don't see a reason for this code to be making such assumptions.

> + /* FALL THRU */

> Tiny nitpick, it looks a bit curious that we spell it FALL THRU here and "fall
> through" a few cases up in the same switch. While we are quite inconsistent
> across the tree, consistency within a file is preferrable (regardless of
> which).

Fair. I tend to shorten it, but I failed to notice that there was
nearby precedent for the other way.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-01-22 16:33:18 Re: psql: Allow editing query results with \gedit
Previous Message Alvaro Herrera 2024-01-22 16:19:14 Re: remaining sql/json patches