|
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
/*
|
|
|
|
|
* $PostgreSQL: pgsql/contrib/btree_gist/btree_interval.c,v 1.12 2009/06/11 14:48:50 momjian Exp $ |
|
|
|
|
* $PostgreSQL: pgsql/contrib/btree_gist/btree_interval.c,v 1.13 2009/12/02 13:13:24 teodor Exp $ |
|
|
|
|
*/ |
|
|
|
|
#include "btree_gist.h" |
|
|
|
|
#include "btree_utils_num.h" |
|
|
|
|
@ -65,12 +65,15 @@ gbt_intvlt(const void *a, const void *b) |
|
|
|
|
static int |
|
|
|
|
gbt_intvkey_cmp(const void *a, const void *b) |
|
|
|
|
{ |
|
|
|
|
return DatumGetInt32( |
|
|
|
|
DirectFunctionCall2(interval_cmp, |
|
|
|
|
IntervalPGetDatum(((Nsrt *) a)->t), |
|
|
|
|
IntervalPGetDatum(((Nsrt *) b)->t) |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
intvKEY *ia = (intvKEY*)(((Nsrt *) a)->t); |
|
|
|
|
intvKEY *ib = (intvKEY*)(((Nsrt *) b)->t); |
|
|
|
|
int res; |
|
|
|
|
|
|
|
|
|
res = DatumGetInt32(DirectFunctionCall2(interval_cmp, IntervalPGetDatum(&ia->lower), IntervalPGetDatum(&ib->lower))); |
|
|
|
|
if (res == 0) |
|
|
|
|
return DatumGetInt32(DirectFunctionCall2(interval_cmp, IntervalPGetDatum(&ia->upper), IntervalPGetDatum(&ib->upper))); |
|
|
|
|
|
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|