mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user