Commit c584103f authored by Tom Lane's avatar Tom Lane

Patch of 2004-03-30 corrected date_part(timestamp) for extracting

the year from a BC date, but failed to make the same fix in
date_part(timestamptz).
parent 19dacd44
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.114 2004/11/01 22:00:30 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.115 2004/11/20 22:12:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -3534,7 +3534,11 @@ timestamptz_part(PG_FUNCTION_ARGS) ...@@ -3534,7 +3534,11 @@ timestamptz_part(PG_FUNCTION_ARGS)
break; break;
case DTK_YEAR: case DTK_YEAR:
if (tm->tm_year > 0)
result = tm->tm_year; result = tm->tm_year;
else
/* there is no year 0, just 1 BC and 1 AD */
result = tm->tm_year - 1;
break; break;
case DTK_DECADE: case DTK_DECADE:
......
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