Use CallerFInfoFunctionCall with btree_gist for numeric types

None of the existing types actually need to use this mechanism, but this
will allow support for enum types which will need it. A separate patch
will adjust the varlena types support for consistency.

Reviewed by Tom Lane and Anastasia Lubennikova

Discussion:  http://postgr.es/m/27220.1478360811@sss.pgh.pa.us
This commit is contained in:
Andrew Dunstan 2017-03-21 09:12:46 -04:00
parent eb2a6131be
commit 4b1c68d63e
17 changed files with 219 additions and 217 deletions

View File

@ -26,33 +26,33 @@ PG_FUNCTION_INFO_V1(gbt_cash_penalty);
PG_FUNCTION_INFO_V1(gbt_cash_same);
static bool
gbt_cashgt(const void *a, const void *b)
gbt_cashgt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Cash *) a) > *((const Cash *) b));
}
static bool
gbt_cashge(const void *a, const void *b)
gbt_cashge(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Cash *) a) >= *((const Cash *) b));
}
static bool
gbt_casheq(const void *a, const void *b)
gbt_casheq(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Cash *) a) == *((const Cash *) b));
}
static bool
gbt_cashle(const void *a, const void *b)
gbt_cashle(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Cash *) a) <= *((const Cash *) b));
}
static bool
gbt_cashlt(const void *a, const void *b)
gbt_cashlt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Cash *) a) < *((const Cash *) b));
}
static int
gbt_cashkey_cmp(const void *a, const void *b)
gbt_cashkey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
cashKEY *ia = (cashKEY *) (((const Nsrt *) a)->t);
cashKEY *ib = (cashKEY *) (((const Nsrt *) b)->t);
@ -69,7 +69,7 @@ gbt_cashkey_cmp(const void *a, const void *b)
}
static float8
gbt_cash_dist(const void *a, const void *b)
gbt_cash_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
return GET_FLOAT_DISTANCE(Cash, a, b);
}
@ -151,7 +151,7 @@ gbt_cash_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -170,7 +170,7 @@ gbt_cash_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -182,7 +182,7 @@ gbt_cash_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(cashKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(cashKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -205,7 +205,7 @@ gbt_cash_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -216,6 +216,6 @@ gbt_cash_same(PG_FUNCTION_ARGS)
cashKEY *b2 = (cashKEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -27,7 +27,7 @@ PG_FUNCTION_INFO_V1(gbt_date_penalty);
PG_FUNCTION_INFO_V1(gbt_date_same);
static bool
gbt_dategt(const void *a, const void *b)
gbt_dategt(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(
DirectFunctionCall2(date_gt, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
@ -35,7 +35,7 @@ gbt_dategt(const void *a, const void *b)
}
static bool
gbt_datege(const void *a, const void *b)
gbt_datege(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(
DirectFunctionCall2(date_ge, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
@ -43,7 +43,7 @@ gbt_datege(const void *a, const void *b)
}
static bool
gbt_dateeq(const void *a, const void *b)
gbt_dateeq(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(
DirectFunctionCall2(date_eq, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
@ -51,7 +51,7 @@ gbt_dateeq(const void *a, const void *b)
}
static bool
gbt_datele(const void *a, const void *b)
gbt_datele(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(
DirectFunctionCall2(date_le, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
@ -59,7 +59,7 @@ gbt_datele(const void *a, const void *b)
}
static bool
gbt_datelt(const void *a, const void *b)
gbt_datelt(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(
DirectFunctionCall2(date_lt, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
@ -69,7 +69,7 @@ gbt_datelt(const void *a, const void *b)
static int
gbt_datekey_cmp(const void *a, const void *b)
gbt_datekey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
dateKEY *ia = (dateKEY *) (((const Nsrt *) a)->t);
dateKEY *ib = (dateKEY *) (((const Nsrt *) b)->t);
@ -83,7 +83,7 @@ gbt_datekey_cmp(const void *a, const void *b)
}
static float8
gdb_date_dist(const void *a, const void *b)
gdb_date_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
/* we assume the difference can't overflow */
Datum diff = DirectFunctionCall2(date_mi,
@ -163,7 +163,7 @@ gbt_date_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -182,7 +182,7 @@ gbt_date_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -194,7 +194,7 @@ gbt_date_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(dateKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(dateKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -244,7 +244,7 @@ gbt_date_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -255,6 +255,6 @@ gbt_date_same(PG_FUNCTION_ARGS)
dateKEY *b2 = (dateKEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -25,33 +25,33 @@ PG_FUNCTION_INFO_V1(gbt_float4_penalty);
PG_FUNCTION_INFO_V1(gbt_float4_same);
static bool
gbt_float4gt(const void *a, const void *b)
gbt_float4gt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float4 *) a) > *((const float4 *) b));
}
static bool
gbt_float4ge(const void *a, const void *b)
gbt_float4ge(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float4 *) a) >= *((const float4 *) b));
}
static bool
gbt_float4eq(const void *a, const void *b)
gbt_float4eq(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float4 *) a) == *((const float4 *) b));
}
static bool
gbt_float4le(const void *a, const void *b)
gbt_float4le(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float4 *) a) <= *((const float4 *) b));
}
static bool
gbt_float4lt(const void *a, const void *b)
gbt_float4lt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float4 *) a) < *((const float4 *) b));
}
static int
gbt_float4key_cmp(const void *a, const void *b)
gbt_float4key_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
float4KEY *ia = (float4KEY *) (((const Nsrt *) a)->t);
float4KEY *ib = (float4KEY *) (((const Nsrt *) b)->t);
@ -68,7 +68,7 @@ gbt_float4key_cmp(const void *a, const void *b)
}
static float8
gbt_float4_dist(const void *a, const void *b)
gbt_float4_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
return GET_FLOAT_DISTANCE(float4, a, b);
}
@ -144,7 +144,7 @@ gbt_float4_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -163,7 +163,7 @@ gbt_float4_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -175,7 +175,7 @@ gbt_float4_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(float4KEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(float4KEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -198,7 +198,7 @@ gbt_float4_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -209,6 +209,6 @@ gbt_float4_same(PG_FUNCTION_ARGS)
float4KEY *b2 = (float4KEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -26,33 +26,33 @@ PG_FUNCTION_INFO_V1(gbt_float8_same);
static bool
gbt_float8gt(const void *a, const void *b)
gbt_float8gt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float8 *) a) > *((const float8 *) b));
}
static bool
gbt_float8ge(const void *a, const void *b)
gbt_float8ge(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float8 *) a) >= *((const float8 *) b));
}
static bool
gbt_float8eq(const void *a, const void *b)
gbt_float8eq(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float8 *) a) == *((const float8 *) b));
}
static bool
gbt_float8le(const void *a, const void *b)
gbt_float8le(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float8 *) a) <= *((const float8 *) b));
}
static bool
gbt_float8lt(const void *a, const void *b)
gbt_float8lt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const float8 *) a) < *((const float8 *) b));
}
static int
gbt_float8key_cmp(const void *a, const void *b)
gbt_float8key_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
float8KEY *ia = (float8KEY *) (((const Nsrt *) a)->t);
float8KEY *ib = (float8KEY *) (((const Nsrt *) b)->t);
@ -69,7 +69,7 @@ gbt_float8key_cmp(const void *a, const void *b)
}
static float8
gbt_float8_dist(const void *a, const void *b)
gbt_float8_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
float8 arg1 = *(const float8 *) a;
float8 arg2 = *(const float8 *) b;
@ -151,7 +151,7 @@ gbt_float8_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -170,7 +170,7 @@ gbt_float8_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -182,7 +182,7 @@ gbt_float8_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(float8KEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(float8KEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -205,7 +205,7 @@ gbt_float8_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -216,6 +216,6 @@ gbt_float8_same(PG_FUNCTION_ARGS)
float8KEY *b2 = (float8KEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -27,33 +27,33 @@ PG_FUNCTION_INFO_V1(gbt_inet_same);
static bool
gbt_inetgt(const void *a, const void *b)
gbt_inetgt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const double *) a) > *((const double *) b));
}
static bool
gbt_inetge(const void *a, const void *b)
gbt_inetge(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const double *) a) >= *((const double *) b));
}
static bool
gbt_ineteq(const void *a, const void *b)
gbt_ineteq(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const double *) a) == *((const double *) b));
}
static bool
gbt_inetle(const void *a, const void *b)
gbt_inetle(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const double *) a) <= *((const double *) b));
}
static bool
gbt_inetlt(const void *a, const void *b)
gbt_inetlt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const double *) a) < *((const double *) b));
}
static int
gbt_inetkey_cmp(const void *a, const void *b)
gbt_inetkey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
inetKEY *ia = (inetKEY *) (((const Nsrt *) a)->t);
inetKEY *ib = (inetKEY *) (((const Nsrt *) b)->t);
@ -133,7 +133,7 @@ gbt_inet_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query,
&strategy, GIST_LEAF(entry), &tinfo));
&strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
}
@ -144,7 +144,7 @@ gbt_inet_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(inetKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(inetKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -167,7 +167,7 @@ gbt_inet_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -178,6 +178,6 @@ gbt_inet_same(PG_FUNCTION_ARGS)
inetKEY *b2 = (inetKEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -25,33 +25,33 @@ PG_FUNCTION_INFO_V1(gbt_int2_penalty);
PG_FUNCTION_INFO_V1(gbt_int2_same);
static bool
gbt_int2gt(const void *a, const void *b)
gbt_int2gt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int16 *) a) > *((const int16 *) b));
}
static bool
gbt_int2ge(const void *a, const void *b)
gbt_int2ge(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int16 *) a) >= *((const int16 *) b));
}
static bool
gbt_int2eq(const void *a, const void *b)
gbt_int2eq(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int16 *) a) == *((const int16 *) b));
}
static bool
gbt_int2le(const void *a, const void *b)
gbt_int2le(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int16 *) a) <= *((const int16 *) b));
}
static bool
gbt_int2lt(const void *a, const void *b)
gbt_int2lt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int16 *) a) < *((const int16 *) b));
}
static int
gbt_int2key_cmp(const void *a, const void *b)
gbt_int2key_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
int16KEY *ia = (int16KEY *) (((const Nsrt *) a)->t);
int16KEY *ib = (int16KEY *) (((const Nsrt *) b)->t);
@ -68,7 +68,7 @@ gbt_int2key_cmp(const void *a, const void *b)
}
static float8
gbt_int2_dist(const void *a, const void *b)
gbt_int2_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
return GET_FLOAT_DISTANCE(int16, a, b);
}
@ -151,7 +151,7 @@ gbt_int2_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -170,7 +170,7 @@ gbt_int2_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -182,7 +182,7 @@ gbt_int2_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(int16KEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(int16KEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -204,7 +204,7 @@ gbt_int2_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -215,6 +215,6 @@ gbt_int2_same(PG_FUNCTION_ARGS)
int16KEY *b2 = (int16KEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -26,33 +26,33 @@ PG_FUNCTION_INFO_V1(gbt_int4_same);
static bool
gbt_int4gt(const void *a, const void *b)
gbt_int4gt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int32 *) a) > *((const int32 *) b));
}
static bool
gbt_int4ge(const void *a, const void *b)
gbt_int4ge(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int32 *) a) >= *((const int32 *) b));
}
static bool
gbt_int4eq(const void *a, const void *b)
gbt_int4eq(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int32 *) a) == *((const int32 *) b));
}
static bool
gbt_int4le(const void *a, const void *b)
gbt_int4le(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int32 *) a) <= *((const int32 *) b));
}
static bool
gbt_int4lt(const void *a, const void *b)
gbt_int4lt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int32 *) a) < *((const int32 *) b));
}
static int
gbt_int4key_cmp(const void *a, const void *b)
gbt_int4key_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
int32KEY *ia = (int32KEY *) (((const Nsrt *) a)->t);
int32KEY *ib = (int32KEY *) (((const Nsrt *) b)->t);
@ -69,7 +69,7 @@ gbt_int4key_cmp(const void *a, const void *b)
}
static float8
gbt_int4_dist(const void *a, const void *b)
gbt_int4_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
return GET_FLOAT_DISTANCE(int32, a, b);
}
@ -152,7 +152,7 @@ gbt_int4_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -171,7 +171,7 @@ gbt_int4_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -183,7 +183,7 @@ gbt_int4_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(int32KEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(int32KEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -205,7 +205,7 @@ gbt_int4_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -216,6 +216,6 @@ gbt_int4_same(PG_FUNCTION_ARGS)
int32KEY *b2 = (int32KEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -26,33 +26,33 @@ PG_FUNCTION_INFO_V1(gbt_int8_same);
static bool
gbt_int8gt(const void *a, const void *b)
gbt_int8gt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int64 *) a) > *((const int64 *) b));
}
static bool
gbt_int8ge(const void *a, const void *b)
gbt_int8ge(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int64 *) a) >= *((const int64 *) b));
}
static bool
gbt_int8eq(const void *a, const void *b)
gbt_int8eq(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int64 *) a) == *((const int64 *) b));
}
static bool
gbt_int8le(const void *a, const void *b)
gbt_int8le(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int64 *) a) <= *((const int64 *) b));
}
static bool
gbt_int8lt(const void *a, const void *b)
gbt_int8lt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const int64 *) a) < *((const int64 *) b));
}
static int
gbt_int8key_cmp(const void *a, const void *b)
gbt_int8key_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
int64KEY *ia = (int64KEY *) (((const Nsrt *) a)->t);
int64KEY *ib = (int64KEY *) (((const Nsrt *) b)->t);
@ -69,7 +69,7 @@ gbt_int8key_cmp(const void *a, const void *b)
}
static float8
gbt_int8_dist(const void *a, const void *b)
gbt_int8_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
return GET_FLOAT_DISTANCE(int64, a, b);
}
@ -152,7 +152,7 @@ gbt_int8_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -171,7 +171,7 @@ gbt_int8_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -183,7 +183,7 @@ gbt_int8_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(int64KEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(int64KEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -205,7 +205,7 @@ gbt_int8_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -216,6 +216,6 @@ gbt_int8_same(PG_FUNCTION_ARGS)
int64KEY *b2 = (int64KEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -30,37 +30,37 @@ PG_FUNCTION_INFO_V1(gbt_intv_same);
static bool
gbt_intvgt(const void *a, const void *b)
gbt_intvgt(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(interval_gt, IntervalPGetDatum(a), IntervalPGetDatum(b)));
}
static bool
gbt_intvge(const void *a, const void *b)
gbt_intvge(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(interval_ge, IntervalPGetDatum(a), IntervalPGetDatum(b)));
}
static bool
gbt_intveq(const void *a, const void *b)
gbt_intveq(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(interval_eq, IntervalPGetDatum(a), IntervalPGetDatum(b)));
}
static bool
gbt_intvle(const void *a, const void *b)
gbt_intvle(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(interval_le, IntervalPGetDatum(a), IntervalPGetDatum(b)));
}
static bool
gbt_intvlt(const void *a, const void *b)
gbt_intvlt(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(interval_lt, IntervalPGetDatum(a), IntervalPGetDatum(b)));
}
static int
gbt_intvkey_cmp(const void *a, const void *b)
gbt_intvkey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
intvKEY *ia = (intvKEY *) (((const Nsrt *) a)->t);
intvKEY *ib = (intvKEY *) (((const Nsrt *) b)->t);
@ -81,7 +81,7 @@ intr2num(const Interval *i)
}
static float8
gbt_intv_dist(const void *a, const void *b)
gbt_intv_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
return (float8) Abs(intr2num((const Interval *) a) - intr2num((const Interval *) b));
}
@ -226,7 +226,7 @@ gbt_intv_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -245,7 +245,7 @@ gbt_intv_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -257,7 +257,7 @@ gbt_intv_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(intvKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(intvKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -287,7 +287,7 @@ gbt_intv_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -298,6 +298,6 @@ gbt_intv_same(PG_FUNCTION_ARGS)
intvKEY *b2 = (intvKEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -28,37 +28,37 @@ PG_FUNCTION_INFO_V1(gbt_macad_same);
static bool
gbt_macadgt(const void *a, const void *b)
gbt_macadgt(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr_gt, PointerGetDatum(a), PointerGetDatum(b)));
}
static bool
gbt_macadge(const void *a, const void *b)
gbt_macadge(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr_ge, PointerGetDatum(a), PointerGetDatum(b)));
}
static bool
gbt_macadeq(const void *a, const void *b)
gbt_macadeq(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr_eq, PointerGetDatum(a), PointerGetDatum(b)));
}
static bool
gbt_macadle(const void *a, const void *b)
gbt_macadle(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr_le, PointerGetDatum(a), PointerGetDatum(b)));
}
static bool
gbt_macadlt(const void *a, const void *b)
gbt_macadlt(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr_lt, PointerGetDatum(a), PointerGetDatum(b)));
}
static int
gbt_macadkey_cmp(const void *a, const void *b)
gbt_macadkey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
macKEY *ia = (macKEY *) (((const Nsrt *) a)->t);
macKEY *ib = (macKEY *) (((const Nsrt *) b)->t);
@ -142,7 +142,7 @@ gbt_macad_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -154,7 +154,7 @@ gbt_macad_union(PG_FUNCTION_ARGS)
void *out = palloc0(sizeof(macKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(macKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -184,7 +184,7 @@ gbt_macad_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -195,6 +195,6 @@ gbt_macad_same(PG_FUNCTION_ARGS)
macKEY *b2 = (macKEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -28,37 +28,37 @@ PG_FUNCTION_INFO_V1(gbt_macad8_same);
static bool
gbt_macad8gt(const void *a, const void *b)
gbt_macad8gt(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr8_gt, PointerGetDatum(a), PointerGetDatum(b)));
}
static bool
gbt_macad8ge(const void *a, const void *b)
gbt_macad8ge(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr8_ge, PointerGetDatum(a), PointerGetDatum(b)));
}
static bool
gbt_macad8eq(const void *a, const void *b)
gbt_macad8eq(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr8_eq, PointerGetDatum(a), PointerGetDatum(b)));
}
static bool
gbt_macad8le(const void *a, const void *b)
gbt_macad8le(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr8_le, PointerGetDatum(a), PointerGetDatum(b)));
}
static bool
gbt_macad8lt(const void *a, const void *b)
gbt_macad8lt(const void *a, const void *b, FmgrInfo *flinfo)
{
return DatumGetBool(DirectFunctionCall2(macaddr8_lt, PointerGetDatum(a), PointerGetDatum(b)));
}
static int
gbt_macad8key_cmp(const void *a, const void *b)
gbt_macad8key_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
mac8KEY *ia = (mac8KEY *) (((const Nsrt *) a)->t);
mac8KEY *ib = (mac8KEY *) (((const Nsrt *) b)->t);
@ -142,7 +142,7 @@ gbt_macad8_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -154,7 +154,7 @@ gbt_macad8_union(PG_FUNCTION_ARGS)
void *out = palloc0(sizeof(mac8KEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(mac8KEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -184,7 +184,7 @@ gbt_macad8_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -195,6 +195,6 @@ gbt_macad8_same(PG_FUNCTION_ARGS)
mac8KEY *b2 = (mac8KEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -26,33 +26,33 @@ PG_FUNCTION_INFO_V1(gbt_oid_same);
static bool
gbt_oidgt(const void *a, const void *b)
gbt_oidgt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Oid *) a) > *((const Oid *) b));
}
static bool
gbt_oidge(const void *a, const void *b)
gbt_oidge(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Oid *) a) >= *((const Oid *) b));
}
static bool
gbt_oideq(const void *a, const void *b)
gbt_oideq(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Oid *) a) == *((const Oid *) b));
}
static bool
gbt_oidle(const void *a, const void *b)
gbt_oidle(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Oid *) a) <= *((const Oid *) b));
}
static bool
gbt_oidlt(const void *a, const void *b)
gbt_oidlt(const void *a, const void *b, FmgrInfo *flinfo)
{
return (*((const Oid *) a) < *((const Oid *) b));
}
static int
gbt_oidkey_cmp(const void *a, const void *b)
gbt_oidkey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
oidKEY *ia = (oidKEY *) (((const Nsrt *) a)->t);
oidKEY *ib = (oidKEY *) (((const Nsrt *) b)->t);
@ -69,7 +69,7 @@ gbt_oidkey_cmp(const void *a, const void *b)
}
static float8
gbt_oid_dist(const void *a, const void *b)
gbt_oid_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
Oid aa = *(const Oid *) a;
Oid bb = *(const Oid *) b;
@ -152,7 +152,7 @@ gbt_oid_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -171,7 +171,7 @@ gbt_oid_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -183,7 +183,7 @@ gbt_oid_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(oidKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(oidKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -205,7 +205,7 @@ gbt_oid_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -216,6 +216,6 @@ gbt_oid_same(PG_FUNCTION_ARGS)
oidKEY *b2 = (oidKEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -38,7 +38,7 @@ PG_FUNCTION_INFO_V1(gbt_time_same);
static bool
gbt_timegt(const void *a, const void *b)
gbt_timegt(const void *a, const void *b, FmgrInfo *flinfo)
{
const TimeADT *aa = (const TimeADT *) a;
const TimeADT *bb = (const TimeADT *) b;
@ -49,7 +49,7 @@ gbt_timegt(const void *a, const void *b)
}
static bool
gbt_timege(const void *a, const void *b)
gbt_timege(const void *a, const void *b, FmgrInfo *flinfo)
{
const TimeADT *aa = (const TimeADT *) a;
const TimeADT *bb = (const TimeADT *) b;
@ -60,7 +60,7 @@ gbt_timege(const void *a, const void *b)
}
static bool
gbt_timeeq(const void *a, const void *b)
gbt_timeeq(const void *a, const void *b, FmgrInfo *flinfo)
{
const TimeADT *aa = (const TimeADT *) a;
const TimeADT *bb = (const TimeADT *) b;
@ -71,7 +71,7 @@ gbt_timeeq(const void *a, const void *b)
}
static bool
gbt_timele(const void *a, const void *b)
gbt_timele(const void *a, const void *b, FmgrInfo *flinfo)
{
const TimeADT *aa = (const TimeADT *) a;
const TimeADT *bb = (const TimeADT *) b;
@ -82,7 +82,7 @@ gbt_timele(const void *a, const void *b)
}
static bool
gbt_timelt(const void *a, const void *b)
gbt_timelt(const void *a, const void *b, FmgrInfo *flinfo)
{
const TimeADT *aa = (const TimeADT *) a;
const TimeADT *bb = (const TimeADT *) b;
@ -95,7 +95,7 @@ gbt_timelt(const void *a, const void *b)
static int
gbt_timekey_cmp(const void *a, const void *b)
gbt_timekey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
timeKEY *ia = (timeKEY *) (((const Nsrt *) a)->t);
timeKEY *ib = (timeKEY *) (((const Nsrt *) b)->t);
@ -109,7 +109,7 @@ gbt_timekey_cmp(const void *a, const void *b)
}
static float8
gbt_time_dist(const void *a, const void *b)
gbt_time_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
const TimeADT *aa = (const TimeADT *) a;
const TimeADT *bb = (const TimeADT *) b;
@ -217,7 +217,7 @@ gbt_time_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -235,7 +235,7 @@ gbt_time_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -261,7 +261,7 @@ gbt_timetz_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &qqq, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &qqq, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -273,7 +273,7 @@ gbt_time_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(timeKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(timeKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -326,7 +326,7 @@ gbt_time_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -337,6 +337,6 @@ gbt_time_same(PG_FUNCTION_ARGS)
timeKEY *b2 = (timeKEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -40,7 +40,7 @@ PG_FUNCTION_INFO_V1(gbt_ts_same);
static bool
gbt_tsgt(const void *a, const void *b)
gbt_tsgt(const void *a, const void *b, FmgrInfo *flinfo)
{
const Timestamp *aa = (const Timestamp *) a;
const Timestamp *bb = (const Timestamp *) b;
@ -51,7 +51,7 @@ gbt_tsgt(const void *a, const void *b)
}
static bool
gbt_tsge(const void *a, const void *b)
gbt_tsge(const void *a, const void *b, FmgrInfo *flinfo)
{
const Timestamp *aa = (const Timestamp *) a;
const Timestamp *bb = (const Timestamp *) b;
@ -62,7 +62,7 @@ gbt_tsge(const void *a, const void *b)
}
static bool
gbt_tseq(const void *a, const void *b)
gbt_tseq(const void *a, const void *b, FmgrInfo *flinfo)
{
const Timestamp *aa = (const Timestamp *) a;
const Timestamp *bb = (const Timestamp *) b;
@ -73,7 +73,7 @@ gbt_tseq(const void *a, const void *b)
}
static bool
gbt_tsle(const void *a, const void *b)
gbt_tsle(const void *a, const void *b, FmgrInfo *flinfo)
{
const Timestamp *aa = (const Timestamp *) a;
const Timestamp *bb = (const Timestamp *) b;
@ -84,7 +84,7 @@ gbt_tsle(const void *a, const void *b)
}
static bool
gbt_tslt(const void *a, const void *b)
gbt_tslt(const void *a, const void *b, FmgrInfo *flinfo)
{
const Timestamp *aa = (const Timestamp *) a;
const Timestamp *bb = (const Timestamp *) b;
@ -96,7 +96,7 @@ gbt_tslt(const void *a, const void *b)
static int
gbt_tskey_cmp(const void *a, const void *b)
gbt_tskey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
tsKEY *ia = (tsKEY *) (((const Nsrt *) a)->t);
tsKEY *ib = (tsKEY *) (((const Nsrt *) b)->t);
@ -110,7 +110,7 @@ gbt_tskey_cmp(const void *a, const void *b)
}
static float8
gbt_ts_dist(const void *a, const void *b)
gbt_ts_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
const Timestamp *aa = (const Timestamp *) a;
const Timestamp *bb = (const Timestamp *) b;
@ -265,7 +265,7 @@ gbt_ts_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -283,7 +283,7 @@ gbt_ts_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -308,7 +308,7 @@ gbt_tstz_consistent(PG_FUNCTION_ARGS)
qqq = tstz_to_ts_gmt(query);
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) &qqq, &strategy, GIST_LEAF(entry), &tinfo)
gbt_num_consistent(&key, (void *) &qqq, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -328,7 +328,7 @@ gbt_tstz_distance(PG_FUNCTION_ARGS)
qqq = tstz_to_ts_gmt(query);
PG_RETURN_FLOAT8(
gbt_num_distance(&key, (void *) &qqq, GIST_LEAF(entry), &tinfo)
gbt_num_distance(&key, (void *) &qqq, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -340,7 +340,7 @@ gbt_ts_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(tsKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(tsKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
@ -389,7 +389,7 @@ gbt_ts_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -400,6 +400,6 @@ gbt_ts_same(PG_FUNCTION_ARGS)
tsKEY *b2 = (tsKEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}

View File

@ -159,7 +159,7 @@ gbt_num_fetch(GISTENTRY *entry, const gbtree_ninfo *tinfo)
*/
void *
gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_ninfo *tinfo)
gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
{
int i,
numranges;
@ -181,9 +181,9 @@ gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_nin
cur = (GBT_NUMKEY *) DatumGetPointer((entryvec->vector[i].key));
c.lower = &cur[0];
c.upper = &cur[tinfo->size];
if ((*tinfo->f_gt) (o.lower, c.lower)) /* out->lower > cur->lower */
if ((*tinfo->f_gt) (o.lower, c.lower, flinfo)) /* out->lower > cur->lower */
memcpy((void *) o.lower, (void *) c.lower, tinfo->size);
if ((*tinfo->f_lt) (o.upper, c.upper)) /* out->upper < cur->upper */
if ((*tinfo->f_lt) (o.upper, c.upper, flinfo)) /* out->upper < cur->upper */
memcpy((void *) o.upper, (void *) c.upper, tinfo->size);
}
@ -197,7 +197,7 @@ gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_nin
*/
bool
gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b, const gbtree_ninfo *tinfo)
gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
{
GBT_NUMKEY_R b1,
b2;
@ -207,13 +207,13 @@ gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b, const gbtree_ninfo *tinfo
b2.lower = &(((GBT_NUMKEY *) b)[0]);
b2.upper = &(((GBT_NUMKEY *) b)[tinfo->size]);
return ((*tinfo->f_eq) (b1.lower, b2.lower) &&
(*tinfo->f_eq) (b1.upper, b2.upper));
return ((*tinfo->f_eq) (b1.lower, b2.lower, flinfo) &&
(*tinfo->f_eq) (b1.upper, b2.upper, flinfo));
}
void
gbt_num_bin_union(Datum *u, GBT_NUMKEY *e, const gbtree_ninfo *tinfo)
gbt_num_bin_union(Datum *u, GBT_NUMKEY *e, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
{
GBT_NUMKEY_R rd;
@ -232,9 +232,9 @@ gbt_num_bin_union(Datum *u, GBT_NUMKEY *e, const gbtree_ninfo *tinfo)
ur.lower = &(((GBT_NUMKEY *) DatumGetPointer(*u))[0]);
ur.upper = &(((GBT_NUMKEY *) DatumGetPointer(*u))[tinfo->size]);
if ((*tinfo->f_gt) ((void *) ur.lower, (void *) rd.lower))
if ((*tinfo->f_gt) ((void *) ur.lower, (void *) rd.lower, flinfo))
memcpy((void *) ur.lower, (void *) rd.lower, tinfo->size);
if ((*tinfo->f_lt) ((void *) ur.upper, (void *) rd.upper))
if ((*tinfo->f_lt) ((void *) ur.upper, (void *) rd.upper, flinfo))
memcpy((void *) ur.upper, (void *) rd.upper, tinfo->size);
}
}
@ -252,39 +252,40 @@ gbt_num_consistent(const GBT_NUMKEY_R *key,
const void *query,
const StrategyNumber *strategy,
bool is_leaf,
const gbtree_ninfo *tinfo)
const gbtree_ninfo *tinfo,
FmgrInfo *flinfo)
{
bool retval;
switch (*strategy)
{
case BTLessEqualStrategyNumber:
retval = (*tinfo->f_ge) (query, key->lower);
retval = (*tinfo->f_ge) (query, key->lower, flinfo);
break;
case BTLessStrategyNumber:
if (is_leaf)
retval = (*tinfo->f_gt) (query, key->lower);
retval = (*tinfo->f_gt) (query, key->lower, flinfo);
else
retval = (*tinfo->f_ge) (query, key->lower);
retval = (*tinfo->f_ge) (query, key->lower, flinfo);
break;
case BTEqualStrategyNumber:
if (is_leaf)
retval = (*tinfo->f_eq) (query, key->lower);
retval = (*tinfo->f_eq) (query, key->lower, flinfo);
else
retval = ((*tinfo->f_le) (key->lower, query) && (*tinfo->f_le) (query, key->upper)) ? true : false;
retval = ((*tinfo->f_le) (key->lower, query, flinfo) && (*tinfo->f_le) (query, key->upper, flinfo)) ? true : false;
break;
case BTGreaterStrategyNumber:
if (is_leaf)
retval = (*tinfo->f_lt) (query, key->upper);
retval = (*tinfo->f_lt) (query, key->upper, flinfo);
else
retval = (*tinfo->f_le) (query, key->upper);
retval = (*tinfo->f_le) (query, key->upper, flinfo);
break;
case BTGreaterEqualStrategyNumber:
retval = (*tinfo->f_le) (query, key->upper);
retval = (*tinfo->f_le) (query, key->upper, flinfo);
break;
case BtreeGistNotEqualStrategyNumber:
retval = (!((*tinfo->f_eq) (query, key->lower) &&
(*tinfo->f_eq) (query, key->upper))) ? true : false;
retval = (!((*tinfo->f_eq) (query, key->lower, flinfo) &&
(*tinfo->f_eq) (query, key->upper, flinfo))) ? true : false;
break;
default:
retval = false;
@ -302,17 +303,18 @@ float8
gbt_num_distance(const GBT_NUMKEY_R *key,
const void *query,
bool is_leaf,
const gbtree_ninfo *tinfo)
const gbtree_ninfo *tinfo,
FmgrInfo *flinfo)
{
float8 retval;
if (tinfo->f_dist == NULL)
elog(ERROR, "KNN search is not supported for btree_gist type %d",
(int) tinfo->t);
if (tinfo->f_le(query, key->lower))
retval = tinfo->f_dist(query, key->lower);
else if (tinfo->f_ge(query, key->upper))
retval = tinfo->f_dist(query, key->upper);
if (tinfo->f_le(query, key->lower, flinfo))
retval = tinfo->f_dist(query, key->lower, flinfo);
else if (tinfo->f_ge(query, key->upper, flinfo))
retval = tinfo->f_dist(query, key->upper, flinfo);
else
retval = 0.0;
@ -322,7 +324,7 @@ gbt_num_distance(const GBT_NUMKEY_R *key,
GIST_SPLITVEC *
gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
const gbtree_ninfo *tinfo)
const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
{
OffsetNumber i,
maxoff = entryvec->n - 1;
@ -345,7 +347,7 @@ gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
arr[i].t = (GBT_NUMKEY *) DatumGetPointer((entryvec->vector[i].key));
arr[i].i = i;
}
qsort((void *) &arr[FirstOffsetNumber], maxoff - FirstOffsetNumber + 1, sizeof(Nsrt), tinfo->f_cmp);
qsort_arg((void *) &arr[FirstOffsetNumber], maxoff - FirstOffsetNumber + 1, sizeof(Nsrt), (qsort_arg_comparator) tinfo->f_cmp, (void *) flinfo);
/* We do simply create two parts */
@ -353,13 +355,13 @@ gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
{
if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
{
gbt_num_bin_union(&v->spl_ldatum, arr[i].t, tinfo);
gbt_num_bin_union(&v->spl_ldatum, arr[i].t, tinfo, flinfo);
v->spl_left[v->spl_nleft] = arr[i].i;
v->spl_nleft++;
}
else
{
gbt_num_bin_union(&v->spl_rdatum, arr[i].t, tinfo);
gbt_num_bin_union(&v->spl_rdatum, arr[i].t, tinfo, flinfo);
v->spl_right[v->spl_nright] = arr[i].i;
v->spl_nright++;
}

View File

@ -42,13 +42,13 @@ typedef struct
/* Methods */
bool (*f_gt) (const void *, const void *); /* greater than */
bool (*f_ge) (const void *, const void *); /* greater or equal */
bool (*f_eq) (const void *, const void *); /* equal */
bool (*f_le) (const void *, const void *); /* less or equal */
bool (*f_lt) (const void *, const void *); /* less than */
int (*f_cmp) (const void *, const void *); /* key compare function */
float8 (*f_dist) (const void *, const void *); /* key distance function */
bool (*f_gt) (const void *, const void *, FmgrInfo *); /* greater than */
bool (*f_ge) (const void *, const void *, FmgrInfo *); /* greater or equal */
bool (*f_eq) (const void *, const void *, FmgrInfo *); /* equal */
bool (*f_le) (const void *, const void *, FmgrInfo *); /* less or equal */
bool (*f_lt) (const void *, const void *, FmgrInfo *); /* less than */
int (*f_cmp) (const void *, const void *, FmgrInfo *); /* key compare function */
float8 (*f_dist) (const void *, const void *, FmgrInfo *); /* key distance function */
} gbtree_ninfo;
@ -113,25 +113,25 @@ extern Interval *abs_interval(Interval *a);
extern bool gbt_num_consistent(const GBT_NUMKEY_R *key, const void *query,
const StrategyNumber *strategy, bool is_leaf,
const gbtree_ninfo *tinfo);
const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern float8 gbt_num_distance(const GBT_NUMKEY_R *key, const void *query,
bool is_leaf, const gbtree_ninfo *tinfo);
bool is_leaf, const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern GIST_SPLITVEC *gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
const gbtree_ninfo *tinfo);
const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern GISTENTRY *gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo);
extern GISTENTRY *gbt_num_fetch(GISTENTRY *entry, const gbtree_ninfo *tinfo);
extern void *gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec,
const gbtree_ninfo *tinfo);
const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern bool gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b,
const gbtree_ninfo *tinfo);
const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern void gbt_num_bin_union(Datum *u, GBT_NUMKEY *e,
const gbtree_ninfo *tinfo);
const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
#endif

View File

@ -34,37 +34,37 @@ uuid_internal_cmp(const pg_uuid_t *arg1, const pg_uuid_t *arg2)
}
static bool
gbt_uuidgt(const void *a, const void *b)
gbt_uuidgt(const void *a, const void *b, FmgrInfo *flinfo)
{
return uuid_internal_cmp((const pg_uuid_t *) a, (const pg_uuid_t *) b) > 0;
}
static bool
gbt_uuidge(const void *a, const void *b)
gbt_uuidge(const void *a, const void *b, FmgrInfo *flinfo)
{
return uuid_internal_cmp((const pg_uuid_t *) a, (const pg_uuid_t *) b) >= 0;
}
static bool
gbt_uuideq(const void *a, const void *b)
gbt_uuideq(const void *a, const void *b, FmgrInfo *flinfo)
{
return uuid_internal_cmp((const pg_uuid_t *) a, (const pg_uuid_t *) b) == 0;
}
static bool
gbt_uuidle(const void *a, const void *b)
gbt_uuidle(const void *a, const void *b, FmgrInfo *flinfo)
{
return uuid_internal_cmp((const pg_uuid_t *) a, (const pg_uuid_t *) b) <= 0;
}
static bool
gbt_uuidlt(const void *a, const void *b)
gbt_uuidlt(const void *a, const void *b, FmgrInfo *flinfo)
{
return uuid_internal_cmp((const pg_uuid_t *) a, (const pg_uuid_t *) b) < 0;
}
static int
gbt_uuidkey_cmp(const void *a, const void *b)
gbt_uuidkey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
uuidKEY *ia = (uuidKEY *) (((const Nsrt *) a)->t);
uuidKEY *ib = (uuidKEY *) (((const Nsrt *) b)->t);
@ -150,7 +150,7 @@ gbt_uuid_consistent(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(
gbt_num_consistent(&key, (void *) query, &strategy,
GIST_LEAF(entry), &tinfo)
GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
);
}
@ -161,7 +161,7 @@ gbt_uuid_union(PG_FUNCTION_ARGS)
void *out = palloc(sizeof(uuidKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(uuidKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
}
/*
@ -222,7 +222,7 @@ gbt_uuid_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_picksplit(
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo
&tinfo, fcinfo->flinfo
));
}
@ -233,6 +233,6 @@ gbt_uuid_same(PG_FUNCTION_ARGS)
uuidKEY *b2 = (uuidKEY *) PG_GETARG_POINTER(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo);
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}