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

Commita8aa2f9

Browse files
author
Thomas G. Lockhart
committed
Repair always-broken date_part('quarter',timestamp).
Previous result did not have correct month boundaries so anything near edge cases was suspect (e.g. April was in Q1 and July, August were lumped into Q2).Thanks to Denis Osadchy <osadchy@turbo.nsk.su> for the report.
1 parent39f987c commita8aa2f9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.40 2000/12/07 18:38:59 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.41 2001/01/03 16:48:02 thomas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1887,9 +1887,9 @@ interval_trunc(PG_FUNCTION_ARGS)
18871887
}
18881888

18891889
/* isoweek2date()
1890-
*
1891-
*Convert ISO week ofyearnumber to date. An yearmust bealready set.
1892-
*karel 2000/08/07
1890+
* Convert ISO week of year number to date.
1891+
*Theyearfieldmust bespecified!
1892+
*karel 2000/08/07
18931893
*/
18941894
void
18951895
isoweek2date(intwoy,int*year,int*mon,int*mday)
@@ -2053,7 +2053,7 @@ timestamp_part(PG_FUNCTION_ARGS)
20532053
break;
20542054

20552055
caseDTK_QUARTER:
2056-
result= (tm->tm_mon/4)+1;
2056+
result= ((tm->tm_mon-1) /3)+1;
20572057
break;
20582058

20592059
caseDTK_WEEK:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp