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: Replace float8 with int in date2isoweek() and date2isoyear().
Date: Sat, 12 Jul 2025 15:50:43 +0000
Message-ID: <E1uacUt-005wpd-1o@gemulon.postgresql.org> (raw)

Replace float8 with int in date2isoweek() and date2isoyear().

The values of the "result" variables in these functions are
always integers; using a float8 variable accomplishes nothing
except to incur useless conversions to and from float.  While
that wastes a few nanoseconds, these functions aren't all that
time-critical.  But it seems worth fixing to remove possible
reader confusion.

Also, in the case of date2isoyear(), "result" is a very poorly
chosen variable name because it is *not* the function's result.
Rename it to "week", and do the same in date2isoweek() for
consistency.

Since this is mostly cosmetic, there seems little need
for back-patch.

Author: Sergey Fukanchik <s.fukanchik@postgrespro.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6323a-68726500-1-7def9d00@137821581

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/84ce2587075c9418deda6a2f04b9768e375ebe43

Modified Files
--------------
src/backend/utils/adt/timestamp.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)



Message-ID: <E1uacUt-005wpd-1o@gemulon.postgresql.org>
Permalink:  ../E1uacUt-005wpd-1o@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uacUt-005wpd-1o@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: Replace float8 with int in date2isoweek() and date2isoyear().
  In-Reply-To: <E1uacUt-005wpd-1o@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