1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Fix bug in extract/date_part for milliseconds/miscroseconds and

timestamp/timestamptz combo. Now extract/date_part returns
seconds*1000 or 1000000 + fraction part as the manual stats.
regression test are also fixed.

See the thread in pgsql-hackers:

Subject: Re: [HACKERS] timestamp_part() bug?
Date: Sat, 02 Mar 2002 11:29:53 +0900
This commit is contained in:
Tatsuo Ishii
2002-03-04 03:55:50 +00:00
parent a616cbc5e3
commit 3382fbb60d
3 changed files with 117 additions and 117 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.62 2002/01/12 04:38:27 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.63 2002/03/04 03:55:46 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@ -2410,11 +2410,11 @@ timestamp_part(PG_FUNCTION_ARGS)
switch (val)
{
case DTK_MICROSEC:
result = (fsec * 1000000);
result = (tm->tm_sec + fsec) * 1000000;
break;
case DTK_MILLISEC:
result = (fsec * 1000);
result = (tm->tm_sec + fsec) * 1000;
break;
case DTK_SECOND:
@ -2574,11 +2574,11 @@ timestamptz_part(PG_FUNCTION_ARGS)
break;
case DTK_MICROSEC:
result = (fsec * 1000000);
result = (tm->tm_sec + fsec) * 1000000;
break;
case DTK_MILLISEC:
result = (fsec * 1000);
result = (tm->tm_sec + fsec) * 1000;
break;
case DTK_SECOND: