pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #18993: [BUG] Unreachable code in pg_next_dst_boundary()
3+ messages / 3 participants
[nested] [flat]
* BUG #18993: [BUG] Unreachable code in pg_next_dst_boundary()
@ 2025-07-21 12:29 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: PG Bug reporting form @ 2025-07-21 12:29 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: gorcom2012@gmail.com
The following bug has been logged on the website:
Bug reference: 18993
Logged by: Eugeny Goryachev
Email address: gorcom2012@gmail.com
PostgreSQL version: 17.4
Operating system: Ubuntu
Description:
Hello,
In pg_next_dst_boundary() (src/timezone/localtime.c), the following
condition can never be true:
```
if (tcycles - icycles >= 1 || icycles - tcycles >= 1)
return -1;
```
This is unreachable because icycles is assigned directly from tcycles.
Suggested fix:
Remove this condition entirely
The change is safe as it only removes dead code. All timezone transition
cases are already properly handled by other paths.
Best regards, Eugeny Goryachev
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #18993: [BUG] Unreachable code in pg_next_dst_boundary()
@ 2025-07-21 14:29 Nathan Bossart <nathandbossart@gmail.com>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Bossart @ 2025-07-21 14:29 UTC (permalink / raw)
To: gorcom2012@gmail.com; pgsql-bugs@lists.postgresql.org
On Mon, Jul 21, 2025 at 12:29:16PM +0000, PG Bug reporting form wrote:
> In pg_next_dst_boundary() (src/timezone/localtime.c), the following
> condition can never be true:
> ```
> if (tcycles - icycles >= 1 || icycles - tcycles >= 1)
> return -1;
> ```
> This is unreachable because icycles is assigned directly from tcycles.
I see the following upstream commit and discussion related to this:
https://github.com/eggert/tz/commit/b0bf6d8
https://mm.icann.org/pipermail/tz/2013-August/019493.html
--
nathan
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #18993: [BUG] Unreachable code in pg_next_dst_boundary()
@ 2025-07-21 14:38 Tom Lane <tgl@sss.pgh.pa.us>
parent: Nathan Bossart <nathandbossart@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2025-07-21 14:38 UTC (permalink / raw)
To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: gorcom2012@gmail.com; pgsql-bugs@lists.postgresql.org
Nathan Bossart <nathandbossart@gmail.com> writes:
> On Mon, Jul 21, 2025 at 12:29:16PM +0000, PG Bug reporting form wrote:
>> This is unreachable because icycles is assigned directly from tcycles.
> I see the following upstream commit and discussion related to this:
Yeah. The short answer here is that this code is meant to deal with
cases where time_t is wider than int[64]. Perhaps we're uninterested
in dealing with that case ... but we also don't want to deviate too
far from the upstream tzdb code. So I'm inclined to leave it alone.
As the function's comment mentions,
* A function result of -1 indicates failure (this case does not actually
* occur in our current implementation).
so presumably both "return -1" lines are unreachable.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-07-21 14:38 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-21 12:29 BUG #18993: [BUG] Unreachable code in pg_next_dst_boundary() PG Bug reporting form <noreply@postgresql.org>
2025-07-21 14:29 ` Nathan Bossart <nathandbossart@gmail.com>
2025-07-21 14:38 ` Tom Lane <tgl@sss.pgh.pa.us>
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