Skip to content

Commit 91e7c90

Browse files
committed
Fix internal extract(timezone_minute) formulas
Through various refactorings over time, the extract(timezone_minute from time with time zone) and extract(timezone_minute from timestamp with time zone) implementations ended up with two different but equally nonsensical formulas by using SECS_PER_MINUTE and MINS_PER_HOUR interchangeably. Since those two are of course both the same number, the formulas do work, but for readability, fix them to be semantically correct.
1 parent dde1a35 commit 91e7c90

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/backend/utils/adt/date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2726,7 +2726,7 @@ timetz_part(PG_FUNCTION_ARGS)
27262726
case DTK_TZ_MINUTE:
27272727
result = -tz;
27282728
result /= SECS_PER_MINUTE;
2729-
FMODULO(result, dummy, (double) SECS_PER_MINUTE);
2729+
FMODULO(result, dummy, (double) MINS_PER_HOUR);
27302730
break;
27312731

27322732
case DTK_TZ_HOUR:

src/backend/utils/adt/timestamp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4844,7 +4844,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
48444844

48454845
case DTK_TZ_MINUTE:
48464846
result = -tz;
4847-
result /= MINS_PER_HOUR;
4847+
result /= SECS_PER_MINUTE;
48484848
FMODULO(result, dummy, (double) MINS_PER_HOUR);
48494849
break;
48504850

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy