Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit22d98e7

Browse files
committed
Fix overflow in extract(epoch from interval) for intervals exceeding 68 years.
Seems to have been introduced in 8.1 by careless SECS_PER_DAYsearch-and-replace.
1 parente92da1a commit22d98e7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/backend/utils/adt/timestamp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.181 2007/08/04 01:26:54 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.182 2007/09/16 15:56:20 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -4395,9 +4395,9 @@ interval_part(PG_FUNCTION_ARGS)
43954395
#else
43964396
result=interval->time;
43974397
#endif
4398-
result+= (DAYS_PER_YEAR*SECS_PER_DAY)* (interval->month /MONTHS_PER_YEAR);
4398+
result+= ((double)DAYS_PER_YEAR*SECS_PER_DAY)* (interval->month /MONTHS_PER_YEAR);
43994399
result+= ((double)DAYS_PER_MONTH*SECS_PER_DAY)* (interval->month %MONTHS_PER_YEAR);
4400-
result+=interval->day*SECS_PER_DAY;
4400+
result+=((double)SECS_PER_DAY)*interval->day;
44014401
}
44024402
else
44034403
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp