diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2005-02-27 00:11:35 +0000 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2005-02-27 00:11:35 +0000 |
commit | 1d5b814be9f0a0ee31cad7c78bc8dc75f188766a (patch) | |
tree | 6d3162f46675e8597da160e0147b6174712827bb /contrib/btree_gist/btree_time.c | |
parent | 9f312cde26a22a4982f197db361dd4edc8ffbbfc (diff) | |
download | postgresql-1d5b814be9f0a0ee31cad7c78bc8dc75f188766a.tar.gz postgresql-1d5b814be9f0a0ee31cad7c78bc8dc75f188766a.zip |
Further fix time/timetz...
Diffstat (limited to 'contrib/btree_gist/btree_time.c')
-rw-r--r-- | contrib/btree_gist/btree_time.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/contrib/btree_gist/btree_time.c b/contrib/btree_gist/btree_time.c index c5ee4ad90e3..9d381866d64 100644 --- a/contrib/btree_gist/btree_time.c +++ b/contrib/btree_gist/btree_time.c @@ -29,14 +29,15 @@ Datum gbt_timetz_consistent(PG_FUNCTION_ARGS); Datum gbt_time_penalty(PG_FUNCTION_ARGS); Datum gbt_time_same(PG_FUNCTION_ARGS); - -#define P_TimeADTGetDatum(x) PointerGetDatum( &(x) ) +/* bug in utils/date.h: TimeADT is always store as float8 */ +#define P_TimeADTGetDatum(x) PointerGetDatum( &( (double) (x) ) ) +#define PointerTimeADTGetDatum(x) PointerGetDatum( &( *(double*)(x) ) ) static bool gbt_timegt(const void *a, const void *b) { return DatumGetBool( - DirectFunctionCall2(time_gt, PointerGetDatum(a), PointerGetDatum(b)) + DirectFunctionCall2(time_gt, PointerTimeADTGetDatum(a), PointerTimeADTGetDatum(b)) ); } @@ -44,7 +45,7 @@ static bool gbt_timege(const void *a, const void *b) { return DatumGetBool( - DirectFunctionCall2(time_ge, PointerGetDatum(a), PointerGetDatum(b)) + DirectFunctionCall2(time_ge, PointerTimeADTGetDatum(a), PointerTimeADTGetDatum(b)) ); } @@ -52,7 +53,7 @@ static bool gbt_timeeq(const void *a, const void *b) { return DatumGetBool( - DirectFunctionCall2(time_eq, PointerGetDatum(a), PointerGetDatum(b)) + DirectFunctionCall2(time_eq, PointerTimeADTGetDatum(a), PointerTimeADTGetDatum(b)) ); } @@ -60,7 +61,7 @@ static bool gbt_timele(const void *a, const void *b) { return DatumGetBool( - DirectFunctionCall2(time_le, PointerGetDatum(a), PointerGetDatum(b)) + DirectFunctionCall2(time_le, PointerTimeADTGetDatum(a), PointerTimeADTGetDatum(b)) ); } @@ -68,7 +69,7 @@ static bool gbt_timelt(const void *a, const void *b) { return DatumGetBool( - DirectFunctionCall2(time_lt, PointerGetDatum(a), PointerGetDatum(b)) + DirectFunctionCall2(time_lt, PointerTimeADTGetDatum(a), PointerTimeADTGetDatum(b)) ); } |