Refactor datetime functions' timezone lookup code to reduce duplication.
Tom Lane <tgl@sss.pgh.pa.us>
Refactor datetime functions' timezone lookup code to reduce duplication. We already had five copies of essentially the same logic, and an upcoming patch introduces yet another use-case. That's past my threshold of pain, so introduce a common subroutine. There's not that much net code savings, but the chance of typos should go down. Inspired by a patch from Przemysław Sztoch, but different in detail. Discussion: https://postgr.es/m/01a84551-48dd-1359-bf7e-f6b0203a6bd0@sztoch.pl
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/date.c | modified | +12 −39 |
| src/backend/utils/adt/datetime.c | modified | +85 −0 |
| src/backend/utils/adt/timestamp.c | modified | +37 −141 |
| src/include/utils/datetime.h | modified | +8 −0 |
Discussion
- generate_series for timestamptz and time zone problem 20 messages · 2022-05-31 → 2023-03-18