#include "utils/fmgrprotos.h"
#include "utils/varbit.h"
-
-/*
-** Bit ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_bit_compress);
PG_FUNCTION_INFO_V1(gbt_bit_union);
PG_FUNCTION_INFO_V1(gbt_bit_picksplit);
/**************************************************
- * Bit ops
+ * GiST support functions
**************************************************/
Datum
PG_RETURN_BOOL(retval);
}
-
-
Datum
gbt_bit_union(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_bit_picksplit(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(result);
}
-
Datum
gbt_bit_penalty(PG_FUNCTION_ARGS)
{
bool upper;
} boolKEY;
-/*
-** bool ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_bool_compress);
PG_FUNCTION_INFO_V1(gbt_bool_fetch);
PG_FUNCTION_INFO_V1(gbt_bool_union);
/**************************************************
- * bool ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_bool_compress(PG_FUNCTION_ARGS)
{
GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_bool_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_bool_penalty(PG_FUNCTION_ARGS)
{
#include "btree_utils_var.h"
#include "utils/fmgrprotos.h"
-
-/*
-** Bytea ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_bytea_compress);
PG_FUNCTION_INFO_V1(gbt_bytea_union);
PG_FUNCTION_INFO_V1(gbt_bytea_picksplit);
PointerGetDatum(b)));
}
-
static const gbtree_vinfo tinfo =
{
gbt_t_bytea,
/**************************************************
- * Text ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_bytea_compress(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_var_compress(entry, &tinfo));
}
-
-
Datum
gbt_bytea_consistent(PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(retval);
}
-
-
Datum
gbt_bytea_union(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_bytea_picksplit(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(result);
}
-
Datum
gbt_bytea_penalty(PG_FUNCTION_ARGS)
{
Cash upper;
} cashKEY;
-/*
-** Cash ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_cash_compress);
PG_FUNCTION_INFO_V1(gbt_cash_fetch);
PG_FUNCTION_INFO_V1(gbt_cash_union);
PG_RETURN_CASH(ra);
}
+
/**************************************************
- * Cash ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_cash_compress(PG_FUNCTION_ARGS)
{
fcinfo->flinfo));
}
-
Datum
gbt_cash_distance(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_cash_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_cash_penalty(PG_FUNCTION_ARGS)
{
DateADT upper;
} dateKEY;
-/*
-** date ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_date_compress);
PG_FUNCTION_INFO_V1(gbt_date_fetch);
PG_FUNCTION_INFO_V1(gbt_date_union);
/**************************************************
- * date ops
+ * GiST support functions
**************************************************/
-
-
Datum
gbt_date_compress(PG_FUNCTION_ARGS)
{
fcinfo->flinfo));
}
-
Datum
gbt_date_distance(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_date_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_date_penalty(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(result);
}
-
Datum
gbt_date_picksplit(PG_FUNCTION_ARGS)
{
Oid upper;
} oidKEY;
-/*
-** enum ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_enum_compress);
PG_FUNCTION_INFO_V1(gbt_enum_fetch);
PG_FUNCTION_INFO_V1(gbt_enum_union);
/**************************************************
- * Enum ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_enum_compress(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_enum_penalty(PG_FUNCTION_ARGS)
{
float4 upper;
} float4KEY;
-/*
-** float4 ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_float4_compress);
PG_FUNCTION_INFO_V1(gbt_float4_fetch);
PG_FUNCTION_INFO_V1(gbt_float4_union);
/**************************************************
- * float4 ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_float4_compress(PG_FUNCTION_ARGS)
{
fcinfo->flinfo));
}
-
Datum
gbt_float4_distance(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_float4_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_float4_penalty(PG_FUNCTION_ARGS)
{
float8 upper;
} float8KEY;
-/*
-** float8 ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_float8_compress);
PG_FUNCTION_INFO_V1(gbt_float8_fetch);
PG_FUNCTION_INFO_V1(gbt_float8_union);
PG_RETURN_FLOAT8(fabs(r));
}
+
/**************************************************
- * float8 ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_float8_compress(PG_FUNCTION_ARGS)
{
fcinfo->flinfo));
}
-
Datum
gbt_float8_distance(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_float8_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_float8_penalty(PG_FUNCTION_ARGS)
{
double upper;
} inetKEY;
-/*
-** inet ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_inet_compress);
PG_FUNCTION_INFO_V1(gbt_inet_union);
PG_FUNCTION_INFO_V1(gbt_inet_picksplit);
/**************************************************
- * inet ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_inet_compress(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(retval);
}
-
Datum
gbt_inet_consistent(PG_FUNCTION_ARGS)
{
&strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_inet_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_inet_penalty(PG_FUNCTION_ARGS)
{
int16 upper;
} int16KEY;
-/*
-** int16 ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_int2_compress);
PG_FUNCTION_INFO_V1(gbt_int2_fetch);
PG_FUNCTION_INFO_V1(gbt_int2_union);
PG_FUNCTION_INFO_V1(gbt_int2_penalty);
PG_FUNCTION_INFO_V1(gbt_int2_same);
+
static bool
gbt_int2gt(const void *a, const void *b, FmgrInfo *flinfo)
{
/**************************************************
- * int16 ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_int2_compress(PG_FUNCTION_ARGS)
{
GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_int2_distance(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_int2_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_int2_penalty(PG_FUNCTION_ARGS)
{
int32 upper;
} int32KEY;
-/*
-** int32 ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_int4_compress);
PG_FUNCTION_INFO_V1(gbt_int4_fetch);
PG_FUNCTION_INFO_V1(gbt_int4_union);
PG_FUNCTION_INFO_V1(gbt_int4_penalty);
PG_FUNCTION_INFO_V1(gbt_int4_same);
-
static bool
gbt_int4gt(const void *a, const void *b, FmgrInfo *flinfo)
{
/**************************************************
- * int32 ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_int4_compress(PG_FUNCTION_ARGS)
{
GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_int4_distance(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_int4_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_int4_penalty(PG_FUNCTION_ARGS)
{
int64 upper;
} int64KEY;
-/*
-** int64 ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_int8_compress);
PG_FUNCTION_INFO_V1(gbt_int8_fetch);
PG_FUNCTION_INFO_V1(gbt_int8_union);
/**************************************************
- * int64 ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_int8_compress(PG_FUNCTION_ARGS)
{
GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_int8_distance(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_int8_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_int8_penalty(PG_FUNCTION_ARGS)
{
upper;
} intvKEY;
-
-/*
-** Interval ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_intv_compress);
PG_FUNCTION_INFO_V1(gbt_intv_fetch);
PG_FUNCTION_INFO_V1(gbt_intv_decompress);
/**************************************************
- * interval ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_intv_compress(PG_FUNCTION_ARGS)
{
char pad[4]; /* make struct size = sizeof(gbtreekey16) */
} macKEY;
-/*
-** OID ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_macad_compress);
PG_FUNCTION_INFO_V1(gbt_macad_fetch);
PG_FUNCTION_INFO_V1(gbt_macad_union);
/**************************************************
- * macaddr ops
+ * GiST support functions
**************************************************/
-
-
static uint64
mac_2_uint64(macaddr *m)
{
return res;
}
-
-
Datum
gbt_macad_compress(PG_FUNCTION_ARGS)
{
/* make struct size = sizeof(gbtreekey16) */
} mac8KEY;
-/*
-** OID ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_macad8_compress);
PG_FUNCTION_INFO_V1(gbt_macad8_fetch);
PG_FUNCTION_INFO_V1(gbt_macad8_union);
PG_FUNCTION_INFO_V1(gbt_macad8_penalty);
PG_FUNCTION_INFO_V1(gbt_macad8_same);
-
static bool
gbt_macad8gt(const void *a, const void *b, FmgrInfo *flinfo)
{
/**************************************************
- * macaddr ops
+ * GiST support functions
**************************************************/
-
-
static uint64
mac8_2_uint64(macaddr8 *m)
{
return res;
}
-
-
Datum
gbt_macad8_compress(PG_FUNCTION_ARGS)
{
GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_macad8_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_macad8_penalty(PG_FUNCTION_ARGS)
{
#include "utils/numeric.h"
#include "utils/rel.h"
-/*
-** Bytea ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_numeric_compress);
PG_FUNCTION_INFO_V1(gbt_numeric_union);
PG_FUNCTION_INFO_V1(gbt_numeric_picksplit);
/**************************************************
- * Text ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_numeric_compress(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_var_compress(entry, &tinfo));
}
-
-
Datum
gbt_numeric_consistent(PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(retval);
}
-
-
Datum
gbt_numeric_union(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_numeric_same(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(result);
}
-
Datum
gbt_numeric_penalty(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(result);
}
-
-
Datum
gbt_numeric_picksplit(PG_FUNCTION_ARGS)
{
Oid upper;
} oidKEY;
-/*
-** OID ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_oid_compress);
PG_FUNCTION_INFO_V1(gbt_oid_fetch);
PG_FUNCTION_INFO_V1(gbt_oid_union);
/**************************************************
- * Oid ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_oid_compress(PG_FUNCTION_ARGS)
{
GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_oid_distance(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_oid_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_oid_penalty(PG_FUNCTION_ARGS)
{
#include "mb/pg_wchar.h"
#include "utils/fmgrprotos.h"
-/*
-** Text ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_text_compress);
PG_FUNCTION_INFO_V1(gbt_bpchar_compress);
PG_FUNCTION_INFO_V1(gbt_text_union);
/**************************************************
- * Text ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_text_compress(PG_FUNCTION_ARGS)
{
return gbt_text_compress(fcinfo);
}
-
-
Datum
gbt_text_consistent(PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(retval);
}
-
Datum
gbt_bpchar_consistent(PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(retval);
}
-
Datum
gbt_text_union(PG_FUNCTION_ARGS)
{
&tinfo, fcinfo->flinfo));
}
-
Datum
gbt_text_picksplit(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(result);
}
-
Datum
gbt_text_penalty(PG_FUNCTION_ARGS)
{
TimeADT upper;
} timeKEY;
-/*
-** time ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_time_compress);
PG_FUNCTION_INFO_V1(gbt_timetz_compress);
PG_FUNCTION_INFO_V1(gbt_time_fetch);
TimeADTGetDatumFast(*bb)));
}
-
-
static int
gbt_timekey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
/**************************************************
- * time ops
+ * GiST support functions
**************************************************/
-
-
Datum
gbt_time_compress(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
-
Datum
gbt_timetz_compress(PG_FUNCTION_ARGS)
{
GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_time_union(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
}
-
Datum
gbt_time_penalty(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(result);
}
-
Datum
gbt_time_picksplit(PG_FUNCTION_ARGS)
{
Timestamp upper;
} tsKEY;
-/*
-** timestamp ops
-*/
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_ts_compress);
PG_FUNCTION_INFO_V1(gbt_tstz_compress);
PG_FUNCTION_INFO_V1(gbt_ts_fetch);
#endif
+/* define for comparison */
+
static bool
gbt_tsgt(const void *a, const void *b, FmgrInfo *flinfo)
{
TimestampGetDatumFast(*bb)));
}
-
static int
gbt_tskey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
{
return fabs(INTERVAL_TO_SEC(i));
}
-
static const gbtree_ninfo tinfo =
{
gbt_t_ts,
PG_RETURN_INTERVAL_P(abs_interval(r));
}
-
/**************************************************
- * timestamp ops
+ * GiST support functions
**************************************************/
-
static inline Timestamp
tstz_to_ts_gmt(TimestampTz ts)
{
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
-
Datum
gbt_tstz_compress(PG_FUNCTION_ARGS)
{
} uuidKEY;
-/*
- * UUID ops
- */
+/* GiST support functions */
PG_FUNCTION_INFO_V1(gbt_uuid_compress);
PG_FUNCTION_INFO_V1(gbt_uuid_fetch);
PG_FUNCTION_INFO_V1(gbt_uuid_union);
/**************************************************
- * uuid ops
+ * GiST support functions
**************************************************/
-
Datum
gbt_uuid_compress(PG_FUNCTION_ARGS)
{