From: | Teodor Sigaev <teodor(at)sigaev(dot)ru> |
---|---|
To: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | int64/double for time/timestamp |
Date: | 2005-02-22 10:32:09 |
Message-ID: | 421B0A29.40004@sigaev.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi!
I work on memory leaks during creation index on time/timestamp column using GiST
and found follow problem (?):
For timestamp storage and defines are defined as (from utils/timestamp.h):
#ifdef HAVE_INT64_TIMESTAMP
typedef int64 Timestamp;
#define TimestampGetDatum(X) Int64GetDatum(X)
#define DatumGetTimestamp(X) ((Timestamp) DatumGetInt64(X))
#else
typedef double Timestamp;
#define TimestampGetDatum(X) Float8GetDatum(X)
#define DatumGetTimestamp(X) ((Timestamp) DatumGetFloat8(X))
#endif
It looks consistently, but for time (from utils/date.h):
ifdef HAVE_INT64_TIMESTAMP
typedef int64 TimeADT;
#else
typedef float8 TimeADT;
#endif
#define TimeADTGetDatum(X) Float8GetDatum(X)
#define DatumGetTimeADT(X) ((TimeADT) DatumGetFloat8(X))
So, in case HAVE_INT64_TIMESTAMP int64 may use as float8. Is it correct?
It seems to me, that my last changes in btree_gist produce a error for
btree_time on some architectures for this reason, but the same changes for
timestamp doesn't produce ones.
--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2005-02-22 13:29:47 | Re: Get rid of system attributes in pg_attribute? |
Previous Message | Tom Lane | 2005-02-22 07:51:45 | Re: psql: recall previous command? |