projects
/
users
/
bernd
/
postgres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
97b0520
)
Patch of 2004-03-30 corrected date_part(timestamp) for extracting
author
Tom Lane
<
[email protected]
>
Sat, 20 Nov 2004 22:12:44 +0000
(22:12 +0000)
committer
Tom Lane
<
[email protected]
>
Sat, 20 Nov 2004 22:12:44 +0000
(22:12 +0000)
the year from a BC date, but failed to make the same fix in
date_part(timestamptz).
src/backend/utils/adt/timestamp.c
patch
|
blob
|
blame
|
history
diff --git
a/src/backend/utils/adt/timestamp.c
b/src/backend/utils/adt/timestamp.c
index 4fe4cef7e7162aed053a7c88bcd5f35b08fc7702..f112dbf4532ee28bb17d8e241d92ce544a3f74ab 100644
(file)
--- a/
src/backend/utils/adt/timestamp.c
+++ b/
src/backend/utils/adt/timestamp.c
@@
-3534,7
+3534,11
@@
timestamptz_part(PG_FUNCTION_ARGS)
break;
case DTK_YEAR:
- result = tm->tm_year;
+ if (tm->tm_year > 0)
+ result = tm->tm_year;
+ else
+ /* there is no year 0, just 1 BC and 1 AD */
+ result = tm->tm_year - 1;
break;
case DTK_DECADE: