1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Fix storage size for btree_gist interval indexes. Fix penalty

calculations for interval and time/timetz to behave sanely for both
integer and float timestamps; up to now I think it's been doing
something pretty strange...
This commit is contained in:
Tom Lane
2005-07-21 04:15:04 +00:00
parent a536b2dd80
commit 3976899f29
5 changed files with 42 additions and 37 deletions

View File

@ -63,6 +63,24 @@ typedef struct
} while (0);
/*
* Convert an Interval to an approximate equivalent number of seconds
* (as a double). Here because we need it for time/timetz as well as
* interval. See interval_cmp_internal for comparison.
*/
#ifdef HAVE_INT64_TIMESTAMP
#define INTERVAL_TO_SEC(ivp) \
(((double) (ivp)->time) / ((double) USECS_PER_SEC) + \
(ivp)->day * (24.0 * SECS_PER_HOUR) + \
(ivp)->month * (30.0 * SECS_PER_DAY))
#else
#define INTERVAL_TO_SEC(ivp) \
((ivp)->time + \
(ivp)->day * (24.0 * SECS_PER_HOUR) + \
(ivp)->month * (30.0 * SECS_PER_DAY))
#endif
extern bool gbt_num_consistent(const GBT_NUMKEY_R * key, const void *query,
const StrategyNumber *strategy, bool is_leaf,
const gbtree_ninfo * tinfo);