mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 03:31:15 +02:00
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
|
* 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)
|
switch (val)
|
||||||
{
|
{
|
||||||
case DTK_EPOCH:
|
case DTK_EPOCH:
|
||||||
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
result = ((timestamp - SetEpochTimestamp()) / 1000000e0);
|
result = ((timestamp - SetEpochTimestamp()) / 1000000e0);
|
||||||
|
#else
|
||||||
|
result = timestamp - SetEpochTimestamp();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTK_DOW:
|
case DTK_DOW:
|
||||||
@ -3052,7 +3056,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
case DTK_EPOCH:
|
case DTK_EPOCH:
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
result = ((timestamp - SetEpochTimestamp()) / 100000e0);
|
result = ((timestamp - SetEpochTimestamp()) / 1000000e0);
|
||||||
#else
|
#else
|
||||||
result = timestamp - SetEpochTimestamp();
|
result = timestamp - SetEpochTimestamp();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user