Commit 91e7c903 authored by Peter Eisentraut's avatar Peter Eisentraut

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.
parent dde1a35a
...@@ -2726,7 +2726,7 @@ timetz_part(PG_FUNCTION_ARGS) ...@@ -2726,7 +2726,7 @@ timetz_part(PG_FUNCTION_ARGS)
case DTK_TZ_MINUTE: case DTK_TZ_MINUTE:
result = -tz; result = -tz;
result /= SECS_PER_MINUTE; result /= SECS_PER_MINUTE;
FMODULO(result, dummy, (double) SECS_PER_MINUTE); FMODULO(result, dummy, (double) MINS_PER_HOUR);
break; break;
case DTK_TZ_HOUR: case DTK_TZ_HOUR:
......
...@@ -4844,7 +4844,7 @@ timestamptz_part(PG_FUNCTION_ARGS) ...@@ -4844,7 +4844,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
case DTK_TZ_MINUTE: case DTK_TZ_MINUTE:
result = -tz; result = -tz;
result /= MINS_PER_HOUR; result /= SECS_PER_MINUTE;
FMODULO(result, dummy, (double) MINS_PER_HOUR); FMODULO(result, dummy, (double) MINS_PER_HOUR);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment