int64/double for time/timestamp
От | Teodor Sigaev |
---|---|
Тема | int64/double for time/timestamp |
Дата | |
Msg-id | 421B0A29.40004@sigaev.ru обсуждение исходный текст |
Ответы |
Re: int64/double for time/timestamp
|
Список | 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@sigaev.ru WWW: http://www.sigaev.ru/
В списке pgsql-hackers по дате отправления: