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

Commit47f14e7

Browse files
committed
Repair 7.3 breakage in timestamp-to-date conversion for dates before 2000.
1 parent2d9a001 commit47f14e7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.84 2003/07/17 00:55:37 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.85 2003/07/24 00:21:26 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -348,17 +348,17 @@ timestamp_date(PG_FUNCTION_ARGS)
348348
{
349349
Timestamptimestamp=PG_GETARG_TIMESTAMP(0);
350350
DateADTresult;
351+
structtmtt,
352+
*tm=&tt;
353+
doublefsec;
351354

352355
if (TIMESTAMP_NOT_FINITE(timestamp))
353356
PG_RETURN_NULL();
354357

355-
#ifdefHAVE_INT64_TIMESTAMP
356-
/* Microseconds to days */
357-
result= (timestamp /INT64CONST(86400000000));
358-
#else
359-
/* Seconds to days */
360-
result= (timestamp /86400.0);
361-
#endif
358+
if (timestamp2tm(timestamp,NULL,tm,&fsec,NULL)!=0)
359+
elog(ERROR,"Unable to convert timestamp to date");
360+
361+
result=date2j(tm->tm_year,tm->tm_mon,tm->tm_mday)-POSTGRES_EPOCH_JDATE;
362362

363363
PG_RETURN_DATEADT(result);
364364
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp