From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove redundant function calls in timestamp[tz]_part().
Date: Thu, 12 Dec 2019 17:13:17 +0000
Message-ID: <E1ifS1d-0006uw-Vk@gemulon.postgresql.org> (raw)
Remove redundant function calls in timestamp[tz]_part().
The DTK_DOW/DTK_ISODOW and DTK_DOY switch cases in timestamp_part() and
timestamptz_part() contained calls of timestamp2tm() that were fully
redundant with the ones done just above the switch. This evidently crept
in during commit 258ee1b63, which relocated that code from another place
where the calls were indeed needed. Just delete the redundant calls.
I (tgl) noted that our test coverage of these functions left quite a
bit to be desired, so extend timestamp.sql and timestamptz.sql to
cover all the branches.
Back-patch to all supported branches, as the previous commit was.
There's no real issue here other than some wasted cycles in some
not-too-heavily-used code paths, but the test coverage seems valuable.
Report and patch by Li Japin; test case adjustments by me.
Discussion: https://postgr.es/m/SG2PR06MB37762CAE45DB0F6CA7001EA9B6550@SG2PR06MB3776.apcprd06.prod.outlook.com
Branch
------
REL9_6_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/6bed9b4f6ea5703a68246a3e335181c658d5dd5e
Modified Files
--------------
src/backend/utils/adt/timestamp.c | 16 -
src/test/regress/expected/timestamp.out | 469 +++++++++++++++----------
src/test/regress/expected/timestamptz.out | 551 ++++++++++++++++++++----------
src/test/regress/sql/timestamp.sql | 23 +-
src/test/regress/sql/timestamptz.sql | 29 +-
5 files changed, 693 insertions(+), 395 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Remove redundant function calls in timestamp[tz]_part().
In-Reply-To: <E1ifS1d-0006uw-Vk@gemulon.postgresql.org>
References: <E1ifS1d-0006uw-Vk@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