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.
This commit is contained in:
parent
d61de58906
commit
b3506006b5
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.71 2002/09/02 02:47:04 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.72 2002/09/03 22:55:54 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2871,7 +2871,11 @@ timestamp_part(PG_FUNCTION_ARGS)
|
||||
switch (val)
|
||||
{
|
||||
case DTK_EPOCH:
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
result = ((timestamp - SetEpochTimestamp()) / 1000000e0);
|
||||
#else
|
||||
result = timestamp - SetEpochTimestamp();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case DTK_DOW:
|
||||
@ -3052,7 +3056,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
|
||||
{
|
||||
case DTK_EPOCH:
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
result = ((timestamp - SetEpochTimestamp()) / 100000e0);
|
||||
result = ((timestamp - SetEpochTimestamp()) / 1000000e0);
|
||||
#else
|
||||
result = timestamp - SetEpochTimestamp();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user