public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tatsuo Ishii <[email protected]>
To: [email protected]
Subject: pgpool: Make time calculations always long long.
Date: Thu, 09 Oct 2025 11:35:27 +0000
Message-ID: <[email protected]> (raw)

Make time calculations always long long.

Previously pgpool assumed that time_t to be a simple long. This causes
a lot of compile time warnings on certain systems, for example
OpenBSD because on the system time_t is __int64, which results in long
long. This commit upcasts such calculations to long long to avoid the
issue.

This way times can't get truncated and for the places where time_t is
actually used as a time and not a time diff this would allow pgpool to
keep working correctly post Y2038 on 64 bit clean time_t systems
(e.g. i386 OpenBSD).

Moreover, json_get_long_value_for_key is changed to
json_get_llong_value_for_key and changed the parameter to long long.
This makes it more in line _json_value's integer, which is defined as
int64. This should also give 32 bit platforms proper retrieval of the
max value of an integer and may or may not solve some weird integer
overflow issues.

Backpatch for 4.6 was rebased by Gyorgy Sarvari.

Author: Martijn van Duren <[email protected]>
Reviewed-by: Tatsuo Ishii <[email protected]>
Reviewed-by: Gyorgy Sarvari <[email protected]>
Backpatch-through: v4.6
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004584.html
Discussion: https://www.postgresql.org/message-id/20251003.211957.2067537305399895611.ishii%40postgresql.org
Discussion: https://github.com/pgpool/pgpool2/pull/128

Branch
------
V4_6_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=f91abf862d74b0eeac57857933ecdbb292af4...

Modified Files
--------------
src/include/utils/json.h            |  2 +-
src/include/watchdog/wd_commands.h  |  2 +-
src/include/watchdog/wd_json_data.h |  4 ++--
src/main/pgpool_logger.c            |  2 +-
src/pcp_con/pcp_worker.c            |  4 ++--
src/protocol/pool_connection_pool.c | 12 ++++++------
src/query_cache/pool_memqcache.c    |  6 +++---
src/utils/json.c                    |  2 +-
src/utils/pool_process_reporting.c  |  2 +-
src/utils/pool_relcache.c           |  2 +-
src/watchdog/watchdog.c             |  4 ++--
src/watchdog/wd_commands.c          |  4 ++--
src/watchdog/wd_heartbeat.c         |  4 ++--
src/watchdog/wd_json_data.c         | 20 +++++++++++---------
14 files changed, 36 insertions(+), 34 deletions(-)



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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgpool: Make time calculations always long long.
  In-Reply-To: <[email protected]>

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

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