mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Use CallerFInfoFunctionCall with btree_gist for varlena types
Follow up to commit 393bb504d7 which did this for numeric types.
This commit is contained in:
@ -24,7 +24,7 @@ PG_FUNCTION_INFO_V1(gbt_bit_same);
|
|||||||
/* define for comparison */
|
/* define for comparison */
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_bitgt(const void *a, const void *b, Oid collation)
|
gbt_bitgt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(bitgt,
|
return DatumGetBool(DirectFunctionCall2(bitgt,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -32,7 +32,7 @@ gbt_bitgt(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_bitge(const void *a, const void *b, Oid collation)
|
gbt_bitge(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(bitge,
|
return DatumGetBool(DirectFunctionCall2(bitge,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -40,7 +40,7 @@ gbt_bitge(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_biteq(const void *a, const void *b, Oid collation)
|
gbt_biteq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(biteq,
|
return DatumGetBool(DirectFunctionCall2(biteq,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -48,7 +48,7 @@ gbt_biteq(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_bitle(const void *a, const void *b, Oid collation)
|
gbt_bitle(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(bitle,
|
return DatumGetBool(DirectFunctionCall2(bitle,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -56,7 +56,7 @@ gbt_bitle(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_bitlt(const void *a, const void *b, Oid collation)
|
gbt_bitlt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(bitlt,
|
return DatumGetBool(DirectFunctionCall2(bitlt,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -64,7 +64,7 @@ gbt_bitlt(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32
|
static int32
|
||||||
gbt_bitcmp(const void *a, const void *b, Oid collation)
|
gbt_bitcmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetInt32(DirectFunctionCall2(byteacmp,
|
return DatumGetInt32(DirectFunctionCall2(byteacmp,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -92,7 +92,7 @@ gbt_bit_xfrm(bytea *leaf)
|
|||||||
|
|
||||||
|
|
||||||
static GBT_VARKEY *
|
static GBT_VARKEY *
|
||||||
gbt_bit_l2n(GBT_VARKEY *leaf)
|
gbt_bit_l2n(GBT_VARKEY *leaf, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
GBT_VARKEY *out = leaf;
|
GBT_VARKEY *out = leaf;
|
||||||
GBT_VARKEY_R r = gbt_var_key_readable(leaf);
|
GBT_VARKEY_R r = gbt_var_key_readable(leaf);
|
||||||
@ -152,13 +152,13 @@ gbt_bit_consistent(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (GIST_LEAF(entry))
|
if (GIST_LEAF(entry))
|
||||||
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
|
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
|
||||||
TRUE, &tinfo);
|
TRUE, &tinfo, fcinfo->flinfo);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bytea *q = gbt_bit_xfrm((bytea *) query);
|
bytea *q = gbt_bit_xfrm((bytea *) query);
|
||||||
|
|
||||||
retval = gbt_var_consistent(&r, q, strategy, PG_GET_COLLATION(),
|
retval = gbt_var_consistent(&r, q, strategy, PG_GET_COLLATION(),
|
||||||
FALSE, &tinfo);
|
FALSE, &tinfo, fcinfo->flinfo);
|
||||||
}
|
}
|
||||||
PG_RETURN_BOOL(retval);
|
PG_RETURN_BOOL(retval);
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ gbt_bit_union(PG_FUNCTION_ARGS)
|
|||||||
int32 *size = (int *) PG_GETARG_POINTER(1);
|
int32 *size = (int *) PG_GETARG_POINTER(1);
|
||||||
|
|
||||||
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
|
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
|
||||||
&tinfo));
|
&tinfo, fcinfo->flinfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ gbt_bit_picksplit(PG_FUNCTION_ARGS)
|
|||||||
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
|
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
|
||||||
|
|
||||||
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
|
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
|
||||||
&tinfo);
|
&tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_POINTER(v);
|
PG_RETURN_POINTER(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ gbt_bit_same(PG_FUNCTION_ARGS)
|
|||||||
Datum d2 = PG_GETARG_DATUM(1);
|
Datum d2 = PG_GETARG_DATUM(1);
|
||||||
bool *result = (bool *) PG_GETARG_POINTER(2);
|
bool *result = (bool *) PG_GETARG_POINTER(2);
|
||||||
|
|
||||||
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
|
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_POINTER(result);
|
PG_RETURN_POINTER(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,5 +207,5 @@ gbt_bit_penalty(PG_FUNCTION_ARGS)
|
|||||||
float *result = (float *) PG_GETARG_POINTER(2);
|
float *result = (float *) PG_GETARG_POINTER(2);
|
||||||
|
|
||||||
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
|
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
|
||||||
&tinfo));
|
&tinfo, fcinfo->flinfo));
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ PG_FUNCTION_INFO_V1(gbt_bytea_same);
|
|||||||
/* define for comparison */
|
/* define for comparison */
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_byteagt(const void *a, const void *b, Oid collation)
|
gbt_byteagt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(byteagt,
|
return DatumGetBool(DirectFunctionCall2(byteagt,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -31,7 +31,7 @@ gbt_byteagt(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_byteage(const void *a, const void *b, Oid collation)
|
gbt_byteage(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(byteage,
|
return DatumGetBool(DirectFunctionCall2(byteage,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -39,7 +39,7 @@ gbt_byteage(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_byteaeq(const void *a, const void *b, Oid collation)
|
gbt_byteaeq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(byteaeq,
|
return DatumGetBool(DirectFunctionCall2(byteaeq,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -47,7 +47,7 @@ gbt_byteaeq(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_byteale(const void *a, const void *b, Oid collation)
|
gbt_byteale(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(byteale,
|
return DatumGetBool(DirectFunctionCall2(byteale,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -55,7 +55,7 @@ gbt_byteale(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_bytealt(const void *a, const void *b, Oid collation)
|
gbt_bytealt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(bytealt,
|
return DatumGetBool(DirectFunctionCall2(bytealt,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -63,7 +63,7 @@ gbt_bytealt(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32
|
static int32
|
||||||
gbt_byteacmp(const void *a, const void *b, Oid collation)
|
gbt_byteacmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetInt32(DirectFunctionCall2(byteacmp,
|
return DatumGetInt32(DirectFunctionCall2(byteacmp,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -118,7 +118,7 @@ gbt_bytea_consistent(PG_FUNCTION_ARGS)
|
|||||||
*recheck = false;
|
*recheck = false;
|
||||||
|
|
||||||
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
|
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
|
||||||
GIST_LEAF(entry), &tinfo);
|
GIST_LEAF(entry), &tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_BOOL(retval);
|
PG_RETURN_BOOL(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ gbt_bytea_union(PG_FUNCTION_ARGS)
|
|||||||
int32 *size = (int *) PG_GETARG_POINTER(1);
|
int32 *size = (int *) PG_GETARG_POINTER(1);
|
||||||
|
|
||||||
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
|
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
|
||||||
&tinfo));
|
&tinfo, fcinfo->flinfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ gbt_bytea_picksplit(PG_FUNCTION_ARGS)
|
|||||||
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
|
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
|
||||||
|
|
||||||
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
|
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
|
||||||
&tinfo);
|
&tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_POINTER(v);
|
PG_RETURN_POINTER(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ gbt_bytea_same(PG_FUNCTION_ARGS)
|
|||||||
Datum d2 = PG_GETARG_DATUM(1);
|
Datum d2 = PG_GETARG_DATUM(1);
|
||||||
bool *result = (bool *) PG_GETARG_POINTER(2);
|
bool *result = (bool *) PG_GETARG_POINTER(2);
|
||||||
|
|
||||||
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
|
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_POINTER(result);
|
PG_RETURN_POINTER(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,5 +166,5 @@ gbt_bytea_penalty(PG_FUNCTION_ARGS)
|
|||||||
float *result = (float *) PG_GETARG_POINTER(2);
|
float *result = (float *) PG_GETARG_POINTER(2);
|
||||||
|
|
||||||
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
|
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
|
||||||
&tinfo));
|
&tinfo, fcinfo->flinfo));
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ PG_FUNCTION_INFO_V1(gbt_numeric_same);
|
|||||||
/* define for comparison */
|
/* define for comparison */
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_numeric_gt(const void *a, const void *b, Oid collation)
|
gbt_numeric_gt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(numeric_gt,
|
return DatumGetBool(DirectFunctionCall2(numeric_gt,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -35,7 +35,7 @@ gbt_numeric_gt(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_numeric_ge(const void *a, const void *b, Oid collation)
|
gbt_numeric_ge(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(numeric_ge,
|
return DatumGetBool(DirectFunctionCall2(numeric_ge,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -43,7 +43,7 @@ gbt_numeric_ge(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_numeric_eq(const void *a, const void *b, Oid collation)
|
gbt_numeric_eq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(numeric_eq,
|
return DatumGetBool(DirectFunctionCall2(numeric_eq,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -51,7 +51,7 @@ gbt_numeric_eq(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_numeric_le(const void *a, const void *b, Oid collation)
|
gbt_numeric_le(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(numeric_le,
|
return DatumGetBool(DirectFunctionCall2(numeric_le,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -59,7 +59,7 @@ gbt_numeric_le(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_numeric_lt(const void *a, const void *b, Oid collation)
|
gbt_numeric_lt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2(numeric_lt,
|
return DatumGetBool(DirectFunctionCall2(numeric_lt,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -67,7 +67,7 @@ gbt_numeric_lt(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32
|
static int32
|
||||||
gbt_numeric_cmp(const void *a, const void *b, Oid collation)
|
gbt_numeric_cmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetInt32(DirectFunctionCall2(numeric_cmp,
|
return DatumGetInt32(DirectFunctionCall2(numeric_cmp,
|
||||||
PointerGetDatum(a),
|
PointerGetDatum(a),
|
||||||
@ -122,7 +122,7 @@ gbt_numeric_consistent(PG_FUNCTION_ARGS)
|
|||||||
*recheck = false;
|
*recheck = false;
|
||||||
|
|
||||||
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
|
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
|
||||||
GIST_LEAF(entry), &tinfo);
|
GIST_LEAF(entry), &tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_BOOL(retval);
|
PG_RETURN_BOOL(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ gbt_numeric_union(PG_FUNCTION_ARGS)
|
|||||||
int32 *size = (int *) PG_GETARG_POINTER(1);
|
int32 *size = (int *) PG_GETARG_POINTER(1);
|
||||||
|
|
||||||
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
|
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
|
||||||
&tinfo));
|
&tinfo, fcinfo->flinfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ gbt_numeric_same(PG_FUNCTION_ARGS)
|
|||||||
Datum d2 = PG_GETARG_DATUM(1);
|
Datum d2 = PG_GETARG_DATUM(1);
|
||||||
bool *result = (bool *) PG_GETARG_POINTER(2);
|
bool *result = (bool *) PG_GETARG_POINTER(2);
|
||||||
|
|
||||||
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
|
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_POINTER(result);
|
PG_RETURN_POINTER(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ gbt_numeric_penalty(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
rk = gbt_var_key_readable(org);
|
rk = gbt_var_key_readable(org);
|
||||||
uni = PointerGetDatum(gbt_var_key_copy(&rk));
|
uni = PointerGetDatum(gbt_var_key_copy(&rk));
|
||||||
gbt_var_bin_union(&uni, newe, PG_GET_COLLATION(), &tinfo);
|
gbt_var_bin_union(&uni, newe, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
|
||||||
ok = gbt_var_key_readable(org);
|
ok = gbt_var_key_readable(org);
|
||||||
uk = gbt_var_key_readable((GBT_VARKEY *) DatumGetPointer(uni));
|
uk = gbt_var_key_readable((GBT_VARKEY *) DatumGetPointer(uni));
|
||||||
|
|
||||||
@ -233,6 +233,6 @@ gbt_numeric_picksplit(PG_FUNCTION_ARGS)
|
|||||||
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
|
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
|
||||||
|
|
||||||
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
|
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
|
||||||
&tinfo);
|
&tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_POINTER(v);
|
PG_RETURN_POINTER(v);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ PG_FUNCTION_INFO_V1(gbt_text_same);
|
|||||||
/* define for comparison */
|
/* define for comparison */
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_textgt(const void *a, const void *b, Oid collation)
|
gbt_textgt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2Coll(text_gt,
|
return DatumGetBool(DirectFunctionCall2Coll(text_gt,
|
||||||
collation,
|
collation,
|
||||||
@ -32,7 +32,7 @@ gbt_textgt(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_textge(const void *a, const void *b, Oid collation)
|
gbt_textge(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2Coll(text_ge,
|
return DatumGetBool(DirectFunctionCall2Coll(text_ge,
|
||||||
collation,
|
collation,
|
||||||
@ -41,7 +41,7 @@ gbt_textge(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_texteq(const void *a, const void *b, Oid collation)
|
gbt_texteq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2Coll(texteq,
|
return DatumGetBool(DirectFunctionCall2Coll(texteq,
|
||||||
collation,
|
collation,
|
||||||
@ -50,7 +50,7 @@ gbt_texteq(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_textle(const void *a, const void *b, Oid collation)
|
gbt_textle(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2Coll(text_le,
|
return DatumGetBool(DirectFunctionCall2Coll(text_le,
|
||||||
collation,
|
collation,
|
||||||
@ -59,7 +59,7 @@ gbt_textle(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gbt_textlt(const void *a, const void *b, Oid collation)
|
gbt_textlt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetBool(DirectFunctionCall2Coll(text_lt,
|
return DatumGetBool(DirectFunctionCall2Coll(text_lt,
|
||||||
collation,
|
collation,
|
||||||
@ -68,7 +68,7 @@ gbt_textlt(const void *a, const void *b, Oid collation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32
|
static int32
|
||||||
gbt_textcmp(const void *a, const void *b, Oid collation)
|
gbt_textcmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
return DatumGetInt32(DirectFunctionCall2Coll(bttextcmp,
|
return DatumGetInt32(DirectFunctionCall2Coll(bttextcmp,
|
||||||
collation,
|
collation,
|
||||||
@ -161,7 +161,7 @@ gbt_text_consistent(PG_FUNCTION_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
|
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
|
||||||
GIST_LEAF(entry), &tinfo);
|
GIST_LEAF(entry), &tinfo, fcinfo->flinfo);
|
||||||
|
|
||||||
PG_RETURN_BOOL(retval);
|
PG_RETURN_BOOL(retval);
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ gbt_bpchar_consistent(PG_FUNCTION_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
retval = gbt_var_consistent(&r, trim, strategy, PG_GET_COLLATION(),
|
retval = gbt_var_consistent(&r, trim, strategy, PG_GET_COLLATION(),
|
||||||
GIST_LEAF(entry), &tinfo);
|
GIST_LEAF(entry), &tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_BOOL(retval);
|
PG_RETURN_BOOL(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ gbt_text_union(PG_FUNCTION_ARGS)
|
|||||||
int32 *size = (int *) PG_GETARG_POINTER(1);
|
int32 *size = (int *) PG_GETARG_POINTER(1);
|
||||||
|
|
||||||
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
|
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(),
|
||||||
&tinfo));
|
&tinfo, fcinfo->flinfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ gbt_text_picksplit(PG_FUNCTION_ARGS)
|
|||||||
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
|
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
|
||||||
|
|
||||||
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
|
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
|
||||||
&tinfo);
|
&tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_POINTER(v);
|
PG_RETURN_POINTER(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ gbt_text_same(PG_FUNCTION_ARGS)
|
|||||||
Datum d2 = PG_GETARG_DATUM(1);
|
Datum d2 = PG_GETARG_DATUM(1);
|
||||||
bool *result = (bool *) PG_GETARG_POINTER(2);
|
bool *result = (bool *) PG_GETARG_POINTER(2);
|
||||||
|
|
||||||
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
|
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
|
||||||
PG_RETURN_POINTER(result);
|
PG_RETURN_POINTER(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,5 +237,5 @@ gbt_text_penalty(PG_FUNCTION_ARGS)
|
|||||||
float *result = (float *) PG_GETARG_POINTER(2);
|
float *result = (float *) PG_GETARG_POINTER(2);
|
||||||
|
|
||||||
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
|
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
|
||||||
&tinfo));
|
&tinfo, fcinfo->flinfo));
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
const gbtree_vinfo *tinfo;
|
const gbtree_vinfo *tinfo;
|
||||||
Oid collation;
|
Oid collation;
|
||||||
|
FmgrInfo *flinfo;
|
||||||
} gbt_vsrt_arg;
|
} gbt_vsrt_arg;
|
||||||
|
|
||||||
|
|
||||||
@ -103,12 +104,12 @@ gbt_var_key_copy(const GBT_VARKEY_R *u)
|
|||||||
|
|
||||||
|
|
||||||
static GBT_VARKEY *
|
static GBT_VARKEY *
|
||||||
gbt_var_leaf2node(GBT_VARKEY *leaf, const gbtree_vinfo *tinfo)
|
gbt_var_leaf2node(GBT_VARKEY *leaf, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
GBT_VARKEY *out = leaf;
|
GBT_VARKEY *out = leaf;
|
||||||
|
|
||||||
if (tinfo->f_l2n)
|
if (tinfo->f_l2n)
|
||||||
out = (*tinfo->f_l2n) (leaf);
|
out = (*tinfo->f_l2n) (leaf, flinfo);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -232,7 +233,7 @@ gbt_var_node_truncate(const GBT_VARKEY *node, int32 cpf_length, const gbtree_vin
|
|||||||
|
|
||||||
void
|
void
|
||||||
gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
|
gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
|
||||||
const gbtree_vinfo *tinfo)
|
const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
GBT_VARKEY_R eo = gbt_var_key_readable(e);
|
GBT_VARKEY_R eo = gbt_var_key_readable(e);
|
||||||
GBT_VARKEY_R nr;
|
GBT_VARKEY_R nr;
|
||||||
@ -241,7 +242,7 @@ gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
|
|||||||
{
|
{
|
||||||
GBT_VARKEY *tmp;
|
GBT_VARKEY *tmp;
|
||||||
|
|
||||||
tmp = gbt_var_leaf2node(e, tinfo);
|
tmp = gbt_var_leaf2node(e, tinfo, flinfo);
|
||||||
if (tmp != e)
|
if (tmp != e)
|
||||||
eo = gbt_var_key_readable(tmp);
|
eo = gbt_var_key_readable(tmp);
|
||||||
}
|
}
|
||||||
@ -254,13 +255,13 @@ gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
|
|||||||
nr.lower = ro.lower;
|
nr.lower = ro.lower;
|
||||||
nr.upper = ro.upper;
|
nr.upper = ro.upper;
|
||||||
|
|
||||||
if ((*tinfo->f_cmp) (ro.lower, eo.lower, collation) > 0)
|
if ((*tinfo->f_cmp) (ro.lower, eo.lower, collation, flinfo) > 0)
|
||||||
{
|
{
|
||||||
nr.lower = eo.lower;
|
nr.lower = eo.lower;
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*tinfo->f_cmp) (ro.upper, eo.upper, collation) < 0)
|
if ((*tinfo->f_cmp) (ro.upper, eo.upper, collation, flinfo) < 0)
|
||||||
{
|
{
|
||||||
nr.upper = eo.upper;
|
nr.upper = eo.upper;
|
||||||
update = true;
|
update = true;
|
||||||
@ -321,7 +322,7 @@ gbt_var_fetch(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
GBT_VARKEY *
|
GBT_VARKEY *
|
||||||
gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation,
|
gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation,
|
||||||
const gbtree_vinfo *tinfo)
|
const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
int i = 0,
|
int i = 0,
|
||||||
numranges = entryvec->n;
|
numranges = entryvec->n;
|
||||||
@ -338,7 +339,7 @@ gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation,
|
|||||||
for (i = 1; i < numranges; i++)
|
for (i = 1; i < numranges; i++)
|
||||||
{
|
{
|
||||||
cur = (GBT_VARKEY *) DatumGetPointer(entryvec->vector[i].key);
|
cur = (GBT_VARKEY *) DatumGetPointer(entryvec->vector[i].key);
|
||||||
gbt_var_bin_union(&out, cur, collation, tinfo);
|
gbt_var_bin_union(&out, cur, collation, tinfo, flinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -360,7 +361,7 @@ gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
gbt_var_same(Datum d1, Datum d2, Oid collation,
|
gbt_var_same(Datum d1, Datum d2, Oid collation,
|
||||||
const gbtree_vinfo *tinfo)
|
const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
GBT_VARKEY *t1 = (GBT_VARKEY *) DatumGetPointer(d1);
|
GBT_VARKEY *t1 = (GBT_VARKEY *) DatumGetPointer(d1);
|
||||||
GBT_VARKEY *t2 = (GBT_VARKEY *) DatumGetPointer(d2);
|
GBT_VARKEY *t2 = (GBT_VARKEY *) DatumGetPointer(d2);
|
||||||
@ -370,14 +371,14 @@ gbt_var_same(Datum d1, Datum d2, Oid collation,
|
|||||||
r1 = gbt_var_key_readable(t1);
|
r1 = gbt_var_key_readable(t1);
|
||||||
r2 = gbt_var_key_readable(t2);
|
r2 = gbt_var_key_readable(t2);
|
||||||
|
|
||||||
return ((*tinfo->f_cmp) (r1.lower, r2.lower, collation) == 0 &&
|
return ((*tinfo->f_cmp) (r1.lower, r2.lower, collation, flinfo) == 0 &&
|
||||||
(*tinfo->f_cmp) (r1.upper, r2.upper, collation) == 0);
|
(*tinfo->f_cmp) (r1.upper, r2.upper, collation, flinfo) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float *
|
float *
|
||||||
gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
|
gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
|
||||||
Oid collation, const gbtree_vinfo *tinfo)
|
Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
GBT_VARKEY *orge = (GBT_VARKEY *) DatumGetPointer(o->key);
|
GBT_VARKEY *orge = (GBT_VARKEY *) DatumGetPointer(o->key);
|
||||||
GBT_VARKEY *newe = (GBT_VARKEY *) DatumGetPointer(n->key);
|
GBT_VARKEY *newe = (GBT_VARKEY *) DatumGetPointer(n->key);
|
||||||
@ -391,7 +392,7 @@ gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
|
|||||||
{
|
{
|
||||||
GBT_VARKEY *tmp;
|
GBT_VARKEY *tmp;
|
||||||
|
|
||||||
tmp = gbt_var_leaf2node(newe, tinfo);
|
tmp = gbt_var_leaf2node(newe, tinfo, flinfo);
|
||||||
if (tmp != newe)
|
if (tmp != newe)
|
||||||
nk = gbt_var_key_readable(tmp);
|
nk = gbt_var_key_readable(tmp);
|
||||||
}
|
}
|
||||||
@ -399,9 +400,9 @@ gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
|
|||||||
|
|
||||||
if ((VARSIZE(ok.lower) - VARHDRSZ) == 0 && (VARSIZE(ok.upper) - VARHDRSZ) == 0)
|
if ((VARSIZE(ok.lower) - VARHDRSZ) == 0 && (VARSIZE(ok.upper) - VARHDRSZ) == 0)
|
||||||
*res = 0.0;
|
*res = 0.0;
|
||||||
else if (!(((*tinfo->f_cmp) (nk.lower, ok.lower, collation) >= 0 ||
|
else if (!(((*tinfo->f_cmp) (nk.lower, ok.lower, collation, flinfo) >= 0 ||
|
||||||
gbt_bytea_pf_match(ok.lower, nk.lower, tinfo)) &&
|
gbt_bytea_pf_match(ok.lower, nk.lower, tinfo)) &&
|
||||||
((*tinfo->f_cmp) (nk.upper, ok.upper, collation) <= 0 ||
|
((*tinfo->f_cmp) (nk.upper, ok.upper, collation, flinfo) <= 0 ||
|
||||||
gbt_bytea_pf_match(ok.upper, nk.upper, tinfo))))
|
gbt_bytea_pf_match(ok.upper, nk.upper, tinfo))))
|
||||||
{
|
{
|
||||||
Datum d = PointerGetDatum(0);
|
Datum d = PointerGetDatum(0);
|
||||||
@ -409,9 +410,9 @@ gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
|
|||||||
int32 ol,
|
int32 ol,
|
||||||
ul;
|
ul;
|
||||||
|
|
||||||
gbt_var_bin_union(&d, orge, collation, tinfo);
|
gbt_var_bin_union(&d, orge, collation, tinfo, flinfo);
|
||||||
ol = gbt_var_node_cp_len((GBT_VARKEY *) DatumGetPointer(d), tinfo);
|
ol = gbt_var_node_cp_len((GBT_VARKEY *) DatumGetPointer(d), tinfo);
|
||||||
gbt_var_bin_union(&d, newe, collation, tinfo);
|
gbt_var_bin_union(&d, newe, collation, tinfo, flinfo);
|
||||||
ul = gbt_var_node_cp_len((GBT_VARKEY *) DatumGetPointer(d), tinfo);
|
ul = gbt_var_node_cp_len((GBT_VARKEY *) DatumGetPointer(d), tinfo);
|
||||||
|
|
||||||
if (ul < ol)
|
if (ul < ol)
|
||||||
@ -448,16 +449,16 @@ gbt_vsrt_cmp(const void *a, const void *b, void *arg)
|
|||||||
const gbt_vsrt_arg *varg = (const gbt_vsrt_arg *) arg;
|
const gbt_vsrt_arg *varg = (const gbt_vsrt_arg *) arg;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = (*varg->tinfo->f_cmp) (ar.lower, br.lower, varg->collation);
|
res = (*varg->tinfo->f_cmp) (ar.lower, br.lower, varg->collation, varg->flinfo);
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
return (*varg->tinfo->f_cmp) (ar.upper, br.upper, varg->collation);
|
return (*varg->tinfo->f_cmp) (ar.upper, br.upper, varg->collation, varg->flinfo);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
GIST_SPLITVEC *
|
GIST_SPLITVEC *
|
||||||
gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
|
gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
|
||||||
Oid collation, const gbtree_vinfo *tinfo)
|
Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
OffsetNumber i,
|
OffsetNumber i,
|
||||||
maxoff = entryvec->n - 1;
|
maxoff = entryvec->n - 1;
|
||||||
@ -489,7 +490,7 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
|
|||||||
ro = gbt_var_key_readable((GBT_VARKEY *) cur);
|
ro = gbt_var_key_readable((GBT_VARKEY *) cur);
|
||||||
if (ro.lower == ro.upper) /* leaf */
|
if (ro.lower == ro.upper) /* leaf */
|
||||||
{
|
{
|
||||||
sv[svcntr] = gbt_var_leaf2node((GBT_VARKEY *) cur, tinfo);
|
sv[svcntr] = gbt_var_leaf2node((GBT_VARKEY *) cur, tinfo, flinfo);
|
||||||
arr[i].t = sv[svcntr];
|
arr[i].t = sv[svcntr];
|
||||||
if (sv[svcntr] != (GBT_VARKEY *) cur)
|
if (sv[svcntr] != (GBT_VARKEY *) cur)
|
||||||
svcntr++;
|
svcntr++;
|
||||||
@ -502,6 +503,7 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
|
|||||||
/* sort */
|
/* sort */
|
||||||
varg.tinfo = tinfo;
|
varg.tinfo = tinfo;
|
||||||
varg.collation = collation;
|
varg.collation = collation;
|
||||||
|
varg.flinfo = flinfo;
|
||||||
qsort_arg((void *) &arr[FirstOffsetNumber],
|
qsort_arg((void *) &arr[FirstOffsetNumber],
|
||||||
maxoff - FirstOffsetNumber + 1,
|
maxoff - FirstOffsetNumber + 1,
|
||||||
sizeof(Vsrt),
|
sizeof(Vsrt),
|
||||||
@ -514,13 +516,13 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
|
|||||||
{
|
{
|
||||||
if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
|
if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
|
||||||
{
|
{
|
||||||
gbt_var_bin_union(&v->spl_ldatum, arr[i].t, collation, tinfo);
|
gbt_var_bin_union(&v->spl_ldatum, arr[i].t, collation, tinfo, flinfo);
|
||||||
v->spl_left[v->spl_nleft] = arr[i].i;
|
v->spl_left[v->spl_nleft] = arr[i].i;
|
||||||
v->spl_nleft++;
|
v->spl_nleft++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gbt_var_bin_union(&v->spl_rdatum, arr[i].t, collation, tinfo);
|
gbt_var_bin_union(&v->spl_rdatum, arr[i].t, collation, tinfo, flinfo);
|
||||||
v->spl_right[v->spl_nright] = arr[i].i;
|
v->spl_right[v->spl_nright] = arr[i].i;
|
||||||
v->spl_nright++;
|
v->spl_nright++;
|
||||||
}
|
}
|
||||||
@ -556,7 +558,8 @@ gbt_var_consistent(GBT_VARKEY_R *key,
|
|||||||
StrategyNumber strategy,
|
StrategyNumber strategy,
|
||||||
Oid collation,
|
Oid collation,
|
||||||
bool is_leaf,
|
bool is_leaf,
|
||||||
const gbtree_vinfo *tinfo)
|
const gbtree_vinfo *tinfo,
|
||||||
|
FmgrInfo *flinfo)
|
||||||
{
|
{
|
||||||
bool retval = FALSE;
|
bool retval = FALSE;
|
||||||
|
|
||||||
@ -564,44 +567,44 @@ gbt_var_consistent(GBT_VARKEY_R *key,
|
|||||||
{
|
{
|
||||||
case BTLessEqualStrategyNumber:
|
case BTLessEqualStrategyNumber:
|
||||||
if (is_leaf)
|
if (is_leaf)
|
||||||
retval = (*tinfo->f_ge) (query, key->lower, collation);
|
retval = (*tinfo->f_ge) (query, key->lower, collation, flinfo);
|
||||||
else
|
else
|
||||||
retval = (*tinfo->f_cmp) (query, key->lower, collation) >= 0
|
retval = (*tinfo->f_cmp) (query, key->lower, collation, flinfo) >= 0
|
||||||
|| gbt_var_node_pf_match(key, query, tinfo);
|
|| gbt_var_node_pf_match(key, query, tinfo);
|
||||||
break;
|
break;
|
||||||
case BTLessStrategyNumber:
|
case BTLessStrategyNumber:
|
||||||
if (is_leaf)
|
if (is_leaf)
|
||||||
retval = (*tinfo->f_gt) (query, key->lower, collation);
|
retval = (*tinfo->f_gt) (query, key->lower, collation, flinfo);
|
||||||
else
|
else
|
||||||
retval = (*tinfo->f_cmp) (query, key->lower, collation) >= 0
|
retval = (*tinfo->f_cmp) (query, key->lower, collation, flinfo) >= 0
|
||||||
|| gbt_var_node_pf_match(key, query, tinfo);
|
|| gbt_var_node_pf_match(key, query, tinfo);
|
||||||
break;
|
break;
|
||||||
case BTEqualStrategyNumber:
|
case BTEqualStrategyNumber:
|
||||||
if (is_leaf)
|
if (is_leaf)
|
||||||
retval = (*tinfo->f_eq) (query, key->lower, collation);
|
retval = (*tinfo->f_eq) (query, key->lower, collation, flinfo);
|
||||||
else
|
else
|
||||||
retval =
|
retval =
|
||||||
((*tinfo->f_cmp) (key->lower, query, collation) <= 0 &&
|
((*tinfo->f_cmp) (key->lower, query, collation, flinfo) <= 0 &&
|
||||||
(*tinfo->f_cmp) (query, key->upper, collation) <= 0) ||
|
(*tinfo->f_cmp) (query, key->upper, collation, flinfo) <= 0) ||
|
||||||
gbt_var_node_pf_match(key, query, tinfo);
|
gbt_var_node_pf_match(key, query, tinfo);
|
||||||
break;
|
break;
|
||||||
case BTGreaterStrategyNumber:
|
case BTGreaterStrategyNumber:
|
||||||
if (is_leaf)
|
if (is_leaf)
|
||||||
retval = (*tinfo->f_lt) (query, key->upper, collation);
|
retval = (*tinfo->f_lt) (query, key->upper, collation, flinfo);
|
||||||
else
|
else
|
||||||
retval = (*tinfo->f_cmp) (query, key->upper, collation) <= 0
|
retval = (*tinfo->f_cmp) (query, key->upper, collation, flinfo) <= 0
|
||||||
|| gbt_var_node_pf_match(key, query, tinfo);
|
|| gbt_var_node_pf_match(key, query, tinfo);
|
||||||
break;
|
break;
|
||||||
case BTGreaterEqualStrategyNumber:
|
case BTGreaterEqualStrategyNumber:
|
||||||
if (is_leaf)
|
if (is_leaf)
|
||||||
retval = (*tinfo->f_le) (query, key->upper, collation);
|
retval = (*tinfo->f_le) (query, key->upper, collation, flinfo);
|
||||||
else
|
else
|
||||||
retval = (*tinfo->f_cmp) (query, key->upper, collation) <= 0
|
retval = (*tinfo->f_cmp) (query, key->upper, collation, flinfo) <= 0
|
||||||
|| gbt_var_node_pf_match(key, query, tinfo);
|
|| gbt_var_node_pf_match(key, query, tinfo);
|
||||||
break;
|
break;
|
||||||
case BtreeGistNotEqualStrategyNumber:
|
case BtreeGistNotEqualStrategyNumber:
|
||||||
retval = !((*tinfo->f_eq) (query, key->lower, collation) &&
|
retval = !((*tinfo->f_eq) (query, key->lower, collation, flinfo) &&
|
||||||
(*tinfo->f_eq) (query, key->upper, collation));
|
(*tinfo->f_eq) (query, key->upper, collation, flinfo));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
|
@ -34,13 +34,13 @@ typedef struct
|
|||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
||||||
bool (*f_gt) (const void *, const void *, Oid); /* greater than */
|
bool (*f_gt) (const void *, const void *, Oid, FmgrInfo *); /* greater than */
|
||||||
bool (*f_ge) (const void *, const void *, Oid); /* greater equal */
|
bool (*f_ge) (const void *, const void *, Oid, FmgrInfo *); /* greater equal */
|
||||||
bool (*f_eq) (const void *, const void *, Oid); /* equal */
|
bool (*f_eq) (const void *, const void *, Oid, FmgrInfo *); /* equal */
|
||||||
bool (*f_le) (const void *, const void *, Oid); /* less equal */
|
bool (*f_le) (const void *, const void *, Oid, FmgrInfo *); /* less equal */
|
||||||
bool (*f_lt) (const void *, const void *, Oid); /* less than */
|
bool (*f_lt) (const void *, const void *, Oid, FmgrInfo *); /* less than */
|
||||||
int32 (*f_cmp) (const void *, const void *, Oid); /* compare */
|
int32 (*f_cmp) (const void *, const void *, Oid, FmgrInfo *); /* compare */
|
||||||
GBT_VARKEY *(*f_l2n) (GBT_VARKEY *); /* convert leaf to node */
|
GBT_VARKEY *(*f_l2n) (GBT_VARKEY *, FmgrInfo *flinfo); /* convert leaf to node */
|
||||||
} gbtree_vinfo;
|
} gbtree_vinfo;
|
||||||
|
|
||||||
|
|
||||||
@ -52,22 +52,22 @@ extern GBT_VARKEY *gbt_var_key_copy(const GBT_VARKEY_R *u);
|
|||||||
extern GISTENTRY *gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo);
|
extern GISTENTRY *gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo);
|
||||||
|
|
||||||
extern GBT_VARKEY *gbt_var_union(const GistEntryVector *entryvec, int32 *size,
|
extern GBT_VARKEY *gbt_var_union(const GistEntryVector *entryvec, int32 *size,
|
||||||
Oid collation, const gbtree_vinfo *tinfo);
|
Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
|
||||||
|
|
||||||
extern bool gbt_var_same(Datum d1, Datum d2, Oid collation,
|
extern bool gbt_var_same(Datum d1, Datum d2, Oid collation,
|
||||||
const gbtree_vinfo *tinfo);
|
const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
|
||||||
|
|
||||||
extern float *gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
|
extern float *gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
|
||||||
Oid collation, const gbtree_vinfo *tinfo);
|
Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
|
||||||
|
|
||||||
extern bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query,
|
extern bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query,
|
||||||
StrategyNumber strategy, Oid collation, bool is_leaf,
|
StrategyNumber strategy, Oid collation, bool is_leaf,
|
||||||
const gbtree_vinfo *tinfo);
|
const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
|
||||||
|
|
||||||
extern GIST_SPLITVEC *gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
|
extern GIST_SPLITVEC *gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
|
||||||
Oid collation, const gbtree_vinfo *tinfo);
|
Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
|
||||||
|
|
||||||
extern void gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
|
extern void gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
|
||||||
const gbtree_vinfo *tinfo);
|
const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user