1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-25 21:42:33 +03:00

Fix offset of one for date_part(timespan) when given arguments of

decade, century, or millenium.
This commit is contained in:
Thomas G. Lockhart 1999-02-13 05:34:24 +00:00
parent ba71b81966
commit 8c3fff7337

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.63 1999/02/13 04:25:01 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.64 1999/02/13 05:34:24 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -1744,15 +1744,15 @@ datetime_part(text *units, DateTime *datetime)
break; break;
case DTK_DECADE: case DTK_DECADE:
*result = (tm->tm_year / 10) + 1; *result = (tm->tm_year / 10);
break; break;
case DTK_CENTURY: case DTK_CENTURY:
*result = (tm->tm_year / 100) + 1; *result = (tm->tm_year / 100);
break; break;
case DTK_MILLENIUM: case DTK_MILLENIUM:
*result = (tm->tm_year / 1000) + 1; *result = (tm->tm_year / 1000);
break; break;
default: default: