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

Commitb350600

Browse files
committed
EXTRACT(EPOCH FROM timestamp) gave wrong answers in the int64-timestamp
case for timestamptz input, and differently wrong answers in the float-timestamp case for timestamp input.
1 parentd61de58 commitb350600

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-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.71 2002/09/02 02:47:04 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.72 2002/09/03 22:55:54 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2871,7 +2871,11 @@ timestamp_part(PG_FUNCTION_ARGS)
28712871
switch (val)
28722872
{
28732873
caseDTK_EPOCH:
2874+
#ifdefHAVE_INT64_TIMESTAMP
28742875
result= ((timestamp-SetEpochTimestamp()) /1000000e0);
2876+
#else
2877+
result=timestamp-SetEpochTimestamp();
2878+
#endif
28752879
break;
28762880

28772881
caseDTK_DOW:
@@ -3052,7 +3056,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
30523056
{
30533057
caseDTK_EPOCH:
30543058
#ifdefHAVE_INT64_TIMESTAMP
3055-
result= ((timestamp-SetEpochTimestamp()) /100000e0);
3059+
result= ((timestamp-SetEpochTimestamp()) /1000000e0);
30563060
#else
30573061
result=timestamp-SetEpochTimestamp();
30583062
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp