pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor datetime functions' timezone lookup code to reduce dupl
Date: Fri, 17 Mar 2023 21:47:26 +0000
Message-ID: <E1pdHv4-0042sd-39@gemulon.postgresql.org> (raw)

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3e59e5048d0f20debe4ad79b2e02ca2a76c5daed

Modified Files
--------------
src/backend/utils/adt/date.c      |  51 +++--------
src/backend/utils/adt/datetime.c  |  85 ++++++++++++++++++
src/backend/utils/adt/timestamp.c | 178 ++++++++------------------------------
src/include/utils/datetime.h      |   8 ++
4 files changed, 142 insertions(+), 180 deletions(-)



Message-ID: <E1pdHv4-0042sd-39@gemulon.postgresql.org>
Permalink:  ../E1pdHv4-0042sd-39@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pdHv4-0042sd-39@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor datetime functions' timezone lookup code to reduce dupl
  In-Reply-To: <E1pdHv4-0042sd-39@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox