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

Commitc584103

Browse files
committed
Patch of 2004-03-30 corrected date_part(timestamp) for extracting
the year from a BC date, but failed to make the same fix indate_part(timestamptz).
1 parent19dacd4 commitc584103

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 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.114 2004/11/01 22:00:30 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.115 2004/11/20 22:12:44 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -3534,7 +3534,11 @@ timestamptz_part(PG_FUNCTION_ARGS)
35343534
break;
35353535

35363536
caseDTK_YEAR:
3537-
result=tm->tm_year;
3537+
if (tm->tm_year>0)
3538+
result=tm->tm_year;
3539+
else
3540+
/* there is no year 0, just 1 BC and 1 AD */
3541+
result=tm->tm_year-1;
35383542
break;
35393543

35403544
caseDTK_DECADE:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp