DATA = btree_gist--1.0--1.1.sql \
btree_gist--1.1--1.2.sql btree_gist--1.2.sql btree_gist--1.2--1.3.sql \
btree_gist--1.3--1.4.sql btree_gist--1.4--1.5.sql \
- btree_gist--1.5--1.6.sql
+ btree_gist--1.5--1.6.sql btree_gist--1.6--1.7.sql
PGFILEDESC = "btree_gist - B-tree equivalent GiST operator classes"
REGRESS = init int2 int4 int8 float4 float8 cash oid timestamp timestamptz \
PG_FUNCTION_INFO_V1(gbt_bit_consistent);
PG_FUNCTION_INFO_V1(gbt_bit_penalty);
PG_FUNCTION_INFO_V1(gbt_bit_same);
+PG_FUNCTION_INFO_V1(gbt_bit_sortsupport);
/* define for comparison */
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
&tinfo, fcinfo->flinfo));
}
+
+static int
+gbt_bit_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ /* Use byteacmp(), like gbt_bitcmp() does */
+ return DatumGetInt32(DirectFunctionCall2(byteacmp,
+ PointerGetDatum(a),
+ PointerGetDatum(b)));
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_bit_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ ssup->comparator = gbt_bit_sort_build_cmp;
+ ssup->abbrev_converter = NULL;
+ ssup->abbrev_abort = NULL;
+ ssup->abbrev_full_comparator = NULL;
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_bytea_consistent);
PG_FUNCTION_INFO_V1(gbt_bytea_penalty);
PG_FUNCTION_INFO_V1(gbt_bytea_same);
+PG_FUNCTION_INFO_V1(gbt_bytea_sortsupport);
/* define for comparison */
/**************************************************
- * Text ops
+ * Bytea ops
**************************************************/
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
&tinfo, fcinfo->flinfo));
}
+
+static int
+gbt_bytea_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ return DatumGetInt32(DirectFunctionCall2(byteacmp,
+ PointerGetDatum(a),
+ PointerGetDatum(b)));
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_bytea_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ ssup->comparator = gbt_bytea_sort_build_cmp;
+ ssup->abbrev_converter = NULL;
+ ssup->abbrev_abort = NULL;
+ ssup->abbrev_full_comparator = NULL;
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_cash_distance);
PG_FUNCTION_INFO_V1(gbt_cash_penalty);
PG_FUNCTION_INFO_V1(gbt_cash_same);
+PG_FUNCTION_INFO_V1(gbt_cash_sortsupport);
static bool
gbt_cashgt(const void *a, const void *b, FmgrInfo *flinfo)
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_cash_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ cashKEY *ia = (cashKEY *) DatumGetPointer(a);
+ cashKEY *ib = (cashKEY *) DatumGetPointer(b);
+
+ /* for leaf items we expect lower == upper */
+ Assert(ia->lower == ia->upper);
+ Assert(ib->lower == ib->upper);
+
+ if (ia->lower == ib->lower)
+ return 0;
+
+ return (ia->lower > ib->lower) ? 1 : -1;
+}
+
+static Datum
+gbt_cash_abbrev_convert(Datum original, SortSupport ssup)
+{
+ cashKEY *b1 = (cashKEY *) DatumGetPointer(original);
+ int64 z = b1->lower;
+
+#if SIZEOF_DATUM == 8
+ return Int64GetDatum(z);
+#else
+ return Int32GetDatum(z >> 32);
+#endif
+}
+
+static int
+gbt_cash_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+#if SIZEOF_DATUM == 8
+ int64 a = DatumGetInt64(z1);
+ int64 b = DatumGetInt64(z2);
+#else
+ int32 a = DatumGetInt32(z1);
+ int32 b = DatumGetInt32(z2);
+#endif
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+/*
+ * We never consider aborting the abbreviation.
+ */
+static bool
+gbt_cash_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_cash_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_cash_cmp_abbrev;
+ ssup->abbrev_converter = gbt_cash_abbrev_convert;
+ ssup->abbrev_abort = gbt_cash_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_cash_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_cash_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_date_distance);
PG_FUNCTION_INFO_V1(gbt_date_penalty);
PG_FUNCTION_INFO_V1(gbt_date_same);
+PG_FUNCTION_INFO_V1(gbt_date_sortsupport);
static bool
gbt_dategt(const void *a, const void *b, FmgrInfo *flinfo)
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_date_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ dateKEY *ia = (dateKEY *) PointerGetDatum(a);
+ dateKEY *ib = (dateKEY *) PointerGetDatum(b);
+
+ return DatumGetInt32(DirectFunctionCall2(date_cmp,
+ DateADTGetDatum(ia->lower),
+ DateADTGetDatum(ib->lower)));
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_date_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ ssup->comparator = gbt_date_sort_build_cmp;
+ ssup->abbrev_converter = NULL;
+ ssup->abbrev_abort = NULL;
+ ssup->abbrev_full_comparator = NULL;
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_enum_consistent);
PG_FUNCTION_INFO_V1(gbt_enum_penalty);
PG_FUNCTION_INFO_V1(gbt_enum_same);
+PG_FUNCTION_INFO_V1(gbt_enum_sortsupport);
static bool
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_enum_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ oidKEY *ia = (oidKEY *) DatumGetPointer(a);
+ oidKEY *ib = (oidKEY *) DatumGetPointer(b);
+
+ /* for leaf items we expect lower == upper */
+ Assert(ia->lower == ia->upper);
+ Assert(ib->lower == ib->upper);
+
+ if (ia->lower == ib->lower)
+ return 0;
+
+ return (ia->lower > ib->lower) ? 1 : -1;
+}
+
+static Datum
+gbt_enum_abbrev_convert(Datum original, SortSupport ssup)
+{
+ oidKEY *b1 = (oidKEY *) DatumGetPointer(original);
+
+ return ObjectIdGetDatum(b1->lower);
+}
+
+static int
+gbt_enum_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+ Oid a = DatumGetObjectId(z1);
+ Oid b = DatumGetObjectId(z2);
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+/*
+ * We never consider aborting the abbreviation.
+ */
+static bool
+gbt_enum_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_enum_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_enum_cmp_abbrev;
+ ssup->abbrev_converter = gbt_enum_abbrev_convert;
+ ssup->abbrev_abort = gbt_enum_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_enum_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_enum_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_float4_distance);
PG_FUNCTION_INFO_V1(gbt_float4_penalty);
PG_FUNCTION_INFO_V1(gbt_float4_same);
+PG_FUNCTION_INFO_V1(gbt_float4_sortsupport);
static bool
gbt_float4gt(const void *a, const void *b, FmgrInfo *flinfo)
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+
+static int
+gbt_float4_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ float4KEY *ia = (float4KEY *) DatumGetPointer(a);
+ float4KEY *ib = (float4KEY *) DatumGetPointer(b);
+
+ /* for leaf items we expect lower == upper */
+ Assert(ia->lower == ia->upper);
+ Assert(ib->lower == ib->upper);
+
+ if (ia->lower == ib->lower)
+ return 0;
+
+ return (ia->lower > ib->lower) ? 1 : -1;
+}
+
+static Datum
+gbt_float4_abbrev_convert(Datum original, SortSupport ssup)
+{
+ float4KEY *b1 = (float4KEY *) DatumGetPointer(original);
+
+ return Float4GetDatum(b1->lower);
+}
+
+static int
+gbt_float4_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+ float4 a = DatumGetFloat4(z1);
+ float4 b = DatumGetFloat4(z2);
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+/*
+ * We never consider aborting the abbreviation.
+ */
+static bool
+gbt_float4_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_float4_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_float4_cmp_abbrev;
+ ssup->abbrev_converter = gbt_float4_abbrev_convert;
+ ssup->abbrev_abort = gbt_float4_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_float4_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_float4_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_float8_distance);
PG_FUNCTION_INFO_V1(gbt_float8_penalty);
PG_FUNCTION_INFO_V1(gbt_float8_same);
+PG_FUNCTION_INFO_V1(gbt_float8_sortsupport);
static bool
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_float8_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ float8KEY *ia = (float8KEY *) DatumGetPointer(a);
+ float8KEY *ib = (float8KEY *) DatumGetPointer(b);
+
+ /* for leaf items we expect lower == upper */
+ Assert(ia->lower == ia->upper);
+ Assert(ib->lower == ib->upper);
+
+ if (ia->lower == ib->lower)
+ return 0;
+
+ return (ia->lower > ib->lower) ? 1 : -1;
+}
+
+static Datum
+gbt_float8_abbrev_convert(Datum original, SortSupport ssup)
+{
+ float8KEY *b1 = (float8KEY *) DatumGetPointer(original);
+ float8 z = b1->lower;
+
+#if SIZEOF_DATUM == 8
+ return Float8GetDatum(z);
+#else
+ return Float4GetDatum((float4) z);
+#endif
+}
+
+static int
+gbt_float8_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+#if SIZEOF_DATUM == 8
+ float8 a = DatumGetFloat8(z1);
+ float8 b = DatumGetFloat8(z2);
+#else
+ float4 a = DatumGetFloat4(z1);
+ float4 b = DatumGetFloat4(z2);
+#endif
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+static bool
+gbt_float8_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_float8_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_float8_cmp_abbrev;
+ ssup->abbrev_converter = gbt_float8_abbrev_convert;
+ ssup->abbrev_abort = gbt_float8_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_float8_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_float8_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
--- /dev/null
+/* contrib/btree_gist/btree_gist--1.6--1.7.sql */
+
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "ALTER EXTENSION btree_gist UPDATE TO '1.7'" to load this file. \quit
+
+
+CREATE FUNCTION gbt_int8_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_int8_ops USING gist ADD
+ FUNCTION 11 (int8, int8) gbt_int8_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_int4_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_int4_ops USING gist ADD
+ FUNCTION 11 (int4, int4) gbt_int4_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_int2_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_int2_ops USING gist ADD
+ FUNCTION 11 (int2, int2) gbt_int2_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_float8_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_float8_ops USING gist ADD
+ FUNCTION 11 (float8, float8) gbt_float8_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_float4_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_float4_ops USING gist ADD
+ FUNCTION 11 (float4, float4) gbt_float4_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_enum_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_enum_ops USING gist ADD
+ FUNCTION 11 (anyenum, anyenum) gbt_enum_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_oid_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_oid_ops USING gist ADD
+ FUNCTION 11 (oid, oid) gbt_oid_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_cash_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_cash_ops USING gist ADD
+ FUNCTION 11 (money, money) gbt_cash_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_inet_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_inet_ops USING gist ADD
+ FUNCTION 11 (inet, inet) gbt_inet_sortsupport (internal) ;
+
+ALTER OPERATOR FAMILY gist_cidr_ops USING gist ADD
+ FUNCTION 11 (cidr, cidr) gbt_inet_sortsupport (internal) ;
+
+
+CREATE FUNCTION gbt_macad_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_macaddr_ops USING gist ADD
+ FUNCTION 11 (macaddr, macaddr) gbt_macad_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_macad8_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_macaddr8_ops USING gist ADD
+ FUNCTION 11 (macaddr8, macaddr8) gbt_macad8_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_numeric_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_numeric_ops USING gist ADD
+ FUNCTION 11 (numeric, numeric) gbt_numeric_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_uuid_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_uuid_ops USING gist ADD
+ FUNCTION 11 (uuid, uuid) gbt_uuid_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_ts_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_timestamp_ops USING gist ADD
+ FUNCTION 11 (timestamp, timestamp) gbt_ts_sortsupport (internal) ;
+
+ALTER OPERATOR FAMILY gist_timestamptz_ops USING gist ADD
+ FUNCTION 11 (timestamptz, timestamptz) gbt_ts_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_text_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_text_ops USING gist ADD
+ FUNCTION 11 (text, text) gbt_text_sortsupport (internal) ;
+
+ALTER OPERATOR FAMILY gist_bpchar_ops USING gist ADD
+ FUNCTION 11 (bpchar, bpchar) gbt_text_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_time_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_time_ops USING gist ADD
+ FUNCTION 11 (time, time) gbt_time_sortsupport (internal) ;
+
+ALTER OPERATOR FAMILY gist_timetz_ops USING gist ADD
+ FUNCTION 11 (timetz, timetz) gbt_time_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_bytea_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_bytea_ops USING gist ADD
+ FUNCTION 11 (bytea, bytea) gbt_bytea_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_date_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_date_ops USING gist ADD
+ FUNCTION 11 (date, date) gbt_date_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_bit_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_bit_ops USING gist ADD
+ FUNCTION 11 (bit, bit) gbt_bit_sortsupport (internal) ;
+
+ALTER OPERATOR FAMILY gist_vbit_ops USING gist ADD
+ FUNCTION 11 (varbit, varbit) gbt_bit_sortsupport (internal) ;
+
+CREATE FUNCTION gbt_intv_sortsupport(internal)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C IMMUTABLE STRICT;
+
+ALTER OPERATOR FAMILY gist_interval_ops USING gist ADD
+ FUNCTION 11 (interval, interval) gbt_intv_sortsupport (internal) ;
+
# btree_gist extension
comment = 'support for indexing common datatypes in GiST'
-default_version = '1.6'
+default_version = '1.7'
module_pathname = '$libdir/btree_gist'
relocatable = true
trusted = true
#include "access/nbtree.h"
#include "fmgr.h"
+#include "utils/sortsupport.h"
#define BtreeGistNotEqualStrategyNumber 6
PG_FUNCTION_INFO_V1(gbt_inet_consistent);
PG_FUNCTION_INFO_V1(gbt_inet_penalty);
PG_FUNCTION_INFO_V1(gbt_inet_same);
+PG_FUNCTION_INFO_V1(gbt_inet_sortsupport);
static bool
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_inet_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ inetKEY *ia = (inetKEY *) DatumGetPointer(a);
+ inetKEY *ib = (inetKEY *) DatumGetPointer(b);
+
+ /* for leaf items we expect lower == upper */
+ Assert(ia->lower == ia->upper);
+ Assert(ib->lower == ib->upper);
+
+ if (ia->lower == ib->lower)
+ return 0;
+
+ return (ia->lower > ib->lower) ? 1 : -1;
+}
+
+static Datum
+gbt_inet_abbrev_convert(Datum original, SortSupport ssup)
+{
+ inetKEY *b1 = (inetKEY *) DatumGetPointer(original);
+ double z = b1->lower;
+
+#if SIZEOF_DATUM == 8
+ return Float8GetDatum(z);
+#else
+ return Float4GetDatum((float4) z);
+#endif
+}
+
+static int
+gbt_inet_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+#if SIZEOF_DATUM == 8
+ float8 a = DatumGetFloat8(z1);
+ float8 b = DatumGetFloat8(z2);
+#else
+ float4 a = DatumGetFloat4(z1);
+ float4 b = DatumGetFloat4(z2);
+#endif
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+static bool
+gbt_inet_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_inet_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_inet_cmp_abbrev;
+ ssup->abbrev_converter = gbt_inet_abbrev_convert;
+ ssup->abbrev_abort = gbt_inet_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_inet_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_inet_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_int2_distance);
PG_FUNCTION_INFO_V1(gbt_int2_penalty);
PG_FUNCTION_INFO_V1(gbt_int2_same);
+PG_FUNCTION_INFO_V1(gbt_int2_sortsupport);
static bool
gbt_int2gt(const void *a, const void *b, FmgrInfo *flinfo)
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_int2_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ int16KEY *ia = (int16KEY *) DatumGetPointer(a);
+ int16KEY *ib = (int16KEY *) DatumGetPointer(b);
+
+ /* for leaf items we expect lower == upper */
+ Assert(ia->lower == ia->upper);
+ Assert(ib->lower == ib->upper);
+
+ if (ia->lower == ib->lower)
+ return 0;
+
+ return (ia->lower > ib->lower) ? 1 : -1;
+}
+
+static Datum
+gbt_int2_abbrev_convert(Datum original, SortSupport ssup)
+{
+ int16KEY *b1 = (int16KEY *) DatumGetPointer(original);
+
+ return Int16GetDatum(b1->lower);
+}
+
+static int
+gbt_int2_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+ int16 a = DatumGetInt16(z1);
+ int16 b = DatumGetInt16(z2);
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+/*
+ * We never consider aborting the abbreviation.
+ */
+static bool
+gbt_int2_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_int2_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_int2_cmp_abbrev;
+ ssup->abbrev_converter = gbt_int2_abbrev_convert;
+ ssup->abbrev_abort = gbt_int2_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_int2_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_int2_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_int4_distance);
PG_FUNCTION_INFO_V1(gbt_int4_penalty);
PG_FUNCTION_INFO_V1(gbt_int4_same);
+PG_FUNCTION_INFO_V1(gbt_int4_sortsupport);
static bool
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_int4_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ int32KEY *ia = (int32KEY *) DatumGetPointer(a);
+ int32KEY *ib = (int32KEY *) DatumGetPointer(b);
+
+ /* for leaf items we expect lower == upper */
+ Assert(ia->lower == ia->upper);
+ Assert(ib->lower == ib->upper);
+
+ if (ia->lower == ib->lower)
+ return 0;
+
+ return (ia->lower > ib->lower) ? 1 : -1;
+}
+
+static Datum
+gbt_int4_abbrev_convert(Datum original, SortSupport ssup)
+{
+ int32KEY *b1 = (int32KEY *) DatumGetPointer(original);
+
+ return Int32GetDatum(b1->lower);
+}
+
+static int
+gbt_int4_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+ int32 a = DatumGetInt32(z1);
+ int32 b = DatumGetInt32(z2);
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+/*
+ * We never consider aborting the abbreviation.
+ */
+static bool
+gbt_int4_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_int4_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_int4_cmp_abbrev;
+ ssup->abbrev_converter = gbt_int4_abbrev_convert;
+ ssup->abbrev_abort = gbt_int4_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_int4_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_int4_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_int8_distance);
PG_FUNCTION_INFO_V1(gbt_int8_penalty);
PG_FUNCTION_INFO_V1(gbt_int8_same);
+PG_FUNCTION_INFO_V1(gbt_int8_sortsupport);
static bool
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_int8_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ int64KEY *ia = (int64KEY *) DatumGetPointer(a);
+ int64KEY *ib = (int64KEY *) DatumGetPointer(b);
+
+ /* for leaf items we expect lower == upper */
+ Assert(ia->lower == ia->upper);
+ Assert(ib->lower == ib->upper);
+
+ if (ia->lower == ib->lower)
+ return 0;
+
+ return (ia->lower > ib->lower) ? 1 : -1;
+}
+
+static Datum
+gbt_int8_abbrev_convert(Datum original, SortSupport ssup)
+{
+ int64KEY *b1 = (int64KEY *) DatumGetPointer(original);
+ int64 z = b1->lower;
+
+#if SIZEOF_DATUM == 8
+ return Int64GetDatum(z);
+#else
+ return Int32GetDatum(z >> 32);
+#endif
+}
+
+static int
+gbt_int8_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+#if SIZEOF_DATUM == 8
+ int64 a = DatumGetInt64(z1);
+ int64 b = DatumGetInt64(z2);
+#else
+ int32 a = DatumGetInt32(z1);
+ int32 b = DatumGetInt32(z2);
+#endif
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+/*
+ * We never consider aborting the abbreviation.
+ */
+static bool
+gbt_int8_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_int8_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_int8_cmp_abbrev;
+ ssup->abbrev_converter = gbt_int8_abbrev_convert;
+ ssup->abbrev_abort = gbt_int8_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_int8_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_int8_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_intv_distance);
PG_FUNCTION_INFO_V1(gbt_intv_penalty);
PG_FUNCTION_INFO_V1(gbt_intv_same);
+PG_FUNCTION_INFO_V1(gbt_intv_sortsupport);
static bool
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_intv_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ intvKEY *ia = (intvKEY *) DatumGetPointer(a);
+ intvKEY *ib = (intvKEY *) DatumGetPointer(b);
+
+ return DatumGetInt32(DirectFunctionCall2(interval_cmp,
+ IntervalPGetDatum(&ia->lower),
+ IntervalPGetDatum(&ib->lower)));
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_intv_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ ssup->comparator = gbt_intv_sort_build_cmp;
+ ssup->abbrev_converter = NULL;
+ ssup->abbrev_abort = NULL;
+ ssup->abbrev_full_comparator = NULL;
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_macad_consistent);
PG_FUNCTION_INFO_V1(gbt_macad_penalty);
PG_FUNCTION_INFO_V1(gbt_macad_same);
+PG_FUNCTION_INFO_V1(gbt_macad_sortsupport);
static bool
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_macad_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ macKEY *ma = (macKEY *) DatumGetPointer(a);
+ macKEY *mb = (macKEY *) DatumGetPointer(b);
+ uint64 ia = mac_2_uint64(&ma->lower);
+ uint64 ib = mac_2_uint64(&mb->lower);
+
+ /* for leaf items we expect lower == upper */
+
+ if (ia == ib)
+ return 0;
+
+ return (ia > ib) ? 1 : -1;
+}
+
+static Datum
+gbt_macad_abbrev_convert(Datum original, SortSupport ssup)
+{
+ macKEY *b1 = (macKEY *) DatumGetPointer(original);
+ uint64 z = mac_2_uint64(&b1->lower);
+
+#if SIZEOF_DATUM == 8
+ return UInt64GetDatum(z);
+#else
+ /* use the high 32 bits of the 48-bit integer */
+ return UInt32GetDatum(z >> 16);
+#endif
+}
+
+static int
+gbt_macad_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+#if SIZEOF_DATUM == 8
+ uint64 a = DatumGetUInt64(z1);
+ uint64 b = DatumGetUInt64(z2);
+#else
+ uint32 a = DatumGetUInt32(z1);
+ uint32 b = DatumGetUInt32(z2);
+#endif
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+static bool
+gbt_macad_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_macad_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_macad_cmp_abbrev;
+ ssup->abbrev_converter = gbt_macad_abbrev_convert;
+ ssup->abbrev_abort = gbt_macad_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_macad_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_macad_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_macad8_consistent);
PG_FUNCTION_INFO_V1(gbt_macad8_penalty);
PG_FUNCTION_INFO_V1(gbt_macad8_same);
+PG_FUNCTION_INFO_V1(gbt_macad8_sortsupport);
static bool
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_macad8_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ mac8KEY *ma = (mac8KEY *) DatumGetPointer(a);
+ mac8KEY *mb = (mac8KEY *) DatumGetPointer(b);
+ uint64 ia = mac8_2_uint64(&ma->lower);
+ uint64 ib = mac8_2_uint64(&mb->lower);
+
+ /* for leaf items we expect lower == upper */
+
+ if (ia == ib)
+ return 0;
+
+ return (ia > ib) ? 1 : -1;
+}
+
+static Datum
+gbt_macad8_abbrev_convert(Datum original, SortSupport ssup)
+{
+ mac8KEY *b1 = (mac8KEY *) DatumGetPointer(original);
+ uint64 z = mac8_2_uint64(&b1->lower);
+
+#if SIZEOF_DATUM == 8
+ return UInt64GetDatum(z);
+#else
+ /* use the high bits only */
+ return UInt32GetDatum(z >> 32);
+#endif
+}
+
+static int
+gbt_macad8_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+#if SIZEOF_DATUM == 8
+ uint64 a = DatumGetUInt64(z1);
+ uint64 b = DatumGetUInt64(z2);
+#else
+ uint32 a = DatumGetUInt32(z1);
+ uint32 b = DatumGetUInt32(z2);
+#endif
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+static bool
+gbt_macad8_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_macad8_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_macad8_cmp_abbrev;
+ ssup->abbrev_converter = gbt_macad8_abbrev_convert;
+ ssup->abbrev_abort = gbt_macad8_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_macad8_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_macad8_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_numeric_consistent);
PG_FUNCTION_INFO_V1(gbt_numeric_penalty);
PG_FUNCTION_INFO_V1(gbt_numeric_same);
+PG_FUNCTION_INFO_V1(gbt_numeric_sortsupport);
/* define for comparison */
&tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(v);
}
+
+static int
+gbt_numeric_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ return DatumGetInt32(DirectFunctionCall2(numeric_cmp,
+ PointerGetDatum(a),
+ PointerGetDatum(b)));
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_numeric_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ ssup->comparator = gbt_numeric_sort_build_cmp;
+
+ /*
+ * Numeric has abbreviation routines in numeric.c, but we don't try to use
+ * them here. Maybe later.
+ */
+ ssup->abbrev_converter = NULL;
+ ssup->abbrev_abort = NULL;
+ ssup->abbrev_full_comparator = NULL;
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_oid_distance);
PG_FUNCTION_INFO_V1(gbt_oid_penalty);
PG_FUNCTION_INFO_V1(gbt_oid_same);
+PG_FUNCTION_INFO_V1(gbt_oid_sortsupport);
static bool
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_oid_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ oidKEY *ia = (oidKEY *) DatumGetPointer(a);
+ oidKEY *ib = (oidKEY *) DatumGetPointer(b);
+
+ /* for leaf items we expect lower == upper */
+ Assert(ia->lower == ia->upper);
+ Assert(ib->lower == ib->upper);
+
+ if (ia->lower == ib->lower)
+ return 0;
+
+ return (ia->lower > ib->lower) ? 1 : -1;
+}
+
+static Datum
+gbt_oid_abbrev_convert(Datum original, SortSupport ssup)
+{
+ oidKEY *b1 = (oidKEY *) DatumGetPointer(original);
+
+ return ObjectIdGetDatum(b1->lower);
+}
+
+static int
+gbt_oid_cmp_abbrev(Datum z1, Datum z2, SortSupport ssup)
+{
+ Oid a = DatumGetObjectId(z1);
+ Oid b = DatumGetObjectId(z2);
+
+ if (a > b)
+ return 1;
+ else if (a < b)
+ return -1;
+ else
+ return 0;
+}
+
+/*
+ * We never consider aborting the abbreviation.
+ */
+static bool
+gbt_oid_abbrev_abort(int memtupcount, SortSupport ssup)
+{
+ return false;
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_oid_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ if (ssup->abbreviate)
+ {
+ ssup->comparator = gbt_oid_cmp_abbrev;
+ ssup->abbrev_converter = gbt_oid_abbrev_convert;
+ ssup->abbrev_abort = gbt_oid_abbrev_abort;
+ ssup->abbrev_full_comparator = gbt_oid_sort_build_cmp;
+ }
+ else
+ {
+ ssup->comparator = gbt_oid_sort_build_cmp;
+ }
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_bpchar_consistent);
PG_FUNCTION_INFO_V1(gbt_text_penalty);
PG_FUNCTION_INFO_V1(gbt_text_same);
+PG_FUNCTION_INFO_V1(gbt_text_sortsupport);
/* define for comparison */
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(),
&tinfo, fcinfo->flinfo));
}
+
+static int
+gbt_text_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ return DatumGetInt32(DirectFunctionCall2Coll(bttextcmp,
+ ssup->ssup_collation,
+ PointerGetDatum(a),
+ PointerGetDatum(b)));
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_text_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ ssup->comparator = gbt_text_sort_build_cmp;
+ ssup->abbrev_converter = NULL;
+ ssup->abbrev_abort = NULL;
+ ssup->abbrev_full_comparator = NULL;
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_timetz_consistent);
PG_FUNCTION_INFO_V1(gbt_time_penalty);
PG_FUNCTION_INFO_V1(gbt_time_same);
+PG_FUNCTION_INFO_V1(gbt_time_sortsupport);
#ifdef USE_FLOAT8_BYVAL
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_time_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ timeKEY *ia = (timeKEY *) DatumGetPointer(a);
+ timeKEY *ib = (timeKEY *) DatumGetPointer(b);
+
+ return DatumGetInt32(DirectFunctionCall2(time_cmp,
+ TimeADTGetDatumFast(ia->lower),
+ TimeADTGetDatumFast(ib->lower)));
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_time_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ ssup->comparator = gbt_time_sort_build_cmp;
+ ssup->abbrev_converter = NULL;
+ ssup->abbrev_abort = NULL;
+ ssup->abbrev_full_comparator = NULL;
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_tstz_distance);
PG_FUNCTION_INFO_V1(gbt_ts_penalty);
PG_FUNCTION_INFO_V1(gbt_ts_same);
+PG_FUNCTION_INFO_V1(gbt_ts_sortsupport);
#ifdef USE_FLOAT8_BYVAL
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_ts_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ tsKEY *ia = (tsKEY *) DatumGetPointer(a);
+ tsKEY *ib = (tsKEY *) DatumGetPointer(b);
+
+ return DatumGetInt32(DirectFunctionCall2(timestamp_cmp,
+ TimestampGetDatumFast(ia->lower),
+ TimestampGetDatumFast(ib->lower)));
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_ts_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ ssup->comparator = gbt_ts_sort_build_cmp;
+ ssup->abbrev_converter = NULL;
+ ssup->abbrev_abort = NULL;
+ ssup->abbrev_full_comparator = NULL;
+ PG_RETURN_VOID();
+}
PG_FUNCTION_INFO_V1(gbt_uuid_consistent);
PG_FUNCTION_INFO_V1(gbt_uuid_penalty);
PG_FUNCTION_INFO_V1(gbt_uuid_same);
+PG_FUNCTION_INFO_V1(gbt_uuid_sortsupport);
static int
*result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
PG_RETURN_POINTER(result);
}
+
+static int
+gbt_uuid_sort_build_cmp(Datum a, Datum b, SortSupport ssup)
+{
+ uuidKEY *ua = (uuidKEY *) DatumGetPointer(a);
+ uuidKEY *ub = (uuidKEY *) DatumGetPointer(b);
+
+ return uuid_internal_cmp(&ua->lower, &ub->lower);
+}
+
+/*
+ * Sort support routine for fast GiST index build by sorting.
+ */
+Datum
+gbt_uuid_sortsupport(PG_FUNCTION_ARGS)
+{
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+
+ ssup->comparator = gbt_uuid_sort_build_cmp;
+ ssup->abbrev_converter = NULL;
+ ssup->abbrev_abort = NULL;
+ ssup->abbrev_full_comparator = NULL;
+ PG_RETURN_VOID();
+}
350
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX bitidx ON bittmp USING GIST ( a );
+DEBUG: building index "bitidx" on table "bittmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX bitidx_b ON bittmp USING GIST ( a ) WITH (buffering=on);
+DEBUG: building index "bitidx_b" on table "bittmp" serially
+DROP INDEX bitidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM bittmp WHERE a < '011011000100010111011000110000100';
count
400
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX byteaidx ON byteatmp USING GIST ( a );
+DEBUG: building index "byteaidx" on table "byteatmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX byteaidx_b ON byteatmp USING GIST ( a ) WITH (buffering=on);
+DEBUG: building index "byteaidx_b" on table "byteatmp" serially
+DROP INDEX byteaidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM byteatmp WHERE a < '31b0'::bytea;
count
$21,915.01 | $442.22
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX moneyidx ON moneytmp USING gist ( a );
+DEBUG: building index "moneyidx" on table "moneytmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX moneyidx_b ON moneytmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "moneyidx_b" on table "moneytmp" serially
+DROP INDEX moneyidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM moneytmp WHERE a < '22649.64'::money;
count
400
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX charidx ON chartmp USING GIST ( a );
+DEBUG: building index "charidx" on table "chartmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX charidx_b ON chartmp USING GIST ( a ) WITH (buffering=on);
+DEBUG: building index "charidx_b" on table "chartmp" serially
+DROP INDEX charidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM chartmp WHERE a < '31b0'::char(32);
count
309
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX cidridx ON cidrtmp USING gist ( a );
+DEBUG: building index "cidridx" on table "cidrtmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX cidridx_b ON cidrtmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "cidridx_b" on table "cidrtmp" serially
+DROP INDEX cidridx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM cidrtmp WHERE a < '121.111.63.82'::cidr;
count
03-24-2001 | 39
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX dateidx ON datetmp USING gist ( a );
+DEBUG: building index "dateidx" on table "datetmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX dateidx_b ON datetmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "dateidx_b" on table "datetmp" serially
+DROP INDEX dateidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM datetmp WHERE a < '2001-02-13'::date;
count
230
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX enumidx ON enumtmp USING gist ( a );
+DEBUG: building index "enumidx" on table "enumtmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX enumidx_b ON enumtmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "enumidx_b" on table "enumtmp" serially
+DROP INDEX enumidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM enumtmp WHERE a < 'g'::rainbow;
count
-158.17741 | 20.822586
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX float4idx ON float4tmp USING gist ( a );
+DEBUG: building index "float4idx" on table "float4tmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX float4idx_b ON float4tmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "float4idx_b" on table "float4tmp" serially
+DROP INDEX float4idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM float4tmp WHERE a < -179.0::float4;
count
-1769.73634 | 120.26366000000007
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX float8idx ON float8tmp USING gist ( a );
+DEBUG: building index "float8idx" on table "float8tmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX float8idx_b ON float8tmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "float8idx_b" on table "float8tmp" serially
+DROP INDEX float8idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM float8tmp WHERE a < -1890.0::float8;
count
386
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX inetidx ON inettmp USING gist ( a );
+DEBUG: building index "inetidx" on table "inettmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX inetidx_b ON inettmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "inetidx_b" on table "inettmp" serially
+DROP INDEX inetidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM inettmp WHERE a < '89.225.196.191'::inet;
count
228 | 9
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX int2idx ON int2tmp USING gist ( a );
+DEBUG: building index "int2idx" on table "int2tmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX int2idx_b ON int2tmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "int2idx_b" on table "int2tmp" serially
+DROP INDEX int2idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM int2tmp WHERE a < 237::int2;
count
228 | 9
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX int4idx ON int4tmp USING gist ( a );
+DEBUG: building index "int4idx" on table "int4tmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX int4idx_b ON int4tmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "int4idx_b" on table "int4tmp" serially
+DROP INDEX int4idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM int4tmp WHERE a < 237::int4;
count
478227196042750 | 13655904687909
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX int8idx ON int8tmp USING gist ( a );
+DEBUG: building index "int8idx" on table "int8tmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX int8idx_b ON int8tmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "int8idx_b" on table "int8tmp" serially
+DROP INDEX int8idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM int8tmp WHERE a < 464571291354841::int8;
count
@ 220 days 19 hours 5 mins 42 secs | @ 21 days -2 hours -15 mins -41 secs
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX intervalidx ON intervaltmp USING gist ( a );
+DEBUG: building index "intervalidx" on table "intervaltmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX intervalidx_b ON intervaltmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "intervalidx_b" on table "intervaltmp" serially
+DROP INDEX intervalidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM intervaltmp WHERE a < '199 days 21:21:23'::interval;
count
540
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX macaddridx ON macaddrtmp USING gist ( a );
+DEBUG: building index "macaddridx" on table "macaddrtmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX macaddridx_b ON macaddrtmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "macaddridx_b" on table "macaddrtmp" serially
+DROP INDEX macaddridx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM macaddrtmp WHERE a < '22:00:5c:e5:9b:0d'::macaddr;
count
540
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX macaddr8idx ON macaddr8tmp USING gist ( a );
+DEBUG: building index "macaddr8idx" on table "macaddr8tmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX macaddr8idx_b ON macaddr8tmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "macaddr8idx_b" on table "macaddr8tmp" serially
+DROP INDEX macaddr8idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM macaddr8tmp WHERE a < '22:00:5c:e5:9b:0d'::macaddr8;
count
576
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX numericidx ON numerictmp USING gist ( a );
+DEBUG: building index "numericidx" on table "numerictmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX numericidx_b ON numerictmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "numericidx_b" on table "numerictmp" serially
+DROP INDEX numericidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM numerictmp WHERE a < -1890.0;
count
983
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX oididx ON oidtmp USING gist ( oid );
+DEBUG: building index "oididx" on table "oidtmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX oididx_b ON oidtmp USING gist ( oid ) WITH (buffering=on);
+DEBUG: building index "oididx_b" on table "oidtmp" serially
+DROP INDEX oididx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM oidtmp WHERE oid < 17;
count
400
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX textidx ON texttmp USING GIST ( a );
+DEBUG: building index "textidx" on table "texttmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX textidx_b ON texttmp USING GIST ( a ) WITH (buffering=on);
+DEBUG: building index "textidx_b" on table "texttmp" serially
+DROP INDEX textidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM texttmp WHERE a < '31b0'::text;
count
10:55:32 | @ 1 min 39 secs
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX timeidx ON timetmp USING gist ( a );
+DEBUG: building index "timeidx" on table "timetmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX timeidx_b ON timetmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "timeidx_b" on table "timetmp" serially
+DROP INDEX timeidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM timetmp WHERE a < '10:57:11'::time;
count
Mon Nov 29 20:12:43 2004 | @ 34 days 11 hours 17 mins 35 secs
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX timestampidx ON timestamptmp USING gist ( a );
+DEBUG: building index "timestampidx" on table "timestamptmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX timestampidx_b ON timestamptmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "timestampidx_b" on table "timestamptmp" serially
+DROP INDEX timestampidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM timestamptmp WHERE a < '2004-10-26 08:55:08'::timestamp;
count
Thu Jan 24 12:28:12 2019 PST | @ 37 days 7 hours 28 mins 18 secs
(3 rows)
+SET client_min_messages = DEBUG1;
CREATE INDEX timestamptzidx ON timestamptztmp USING gist ( a );
+DEBUG: building index "timestamptzidx" on table "timestamptztmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX timestamptzidx_b ON timestamptztmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "timestamptzidx_b" on table "timestamptztmp" serially
+DROP INDEX timestamptzidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM timestamptztmp WHERE a < '2018-12-18 10:59:54 GMT+3'::timestamptz;
count
INSERT INTO timetzcmp (r_id,a) SELECT 23,count(*) FROM timetztmp WHERE a = '07:46:45 GMT+4';
INSERT INTO timetzcmp (r_id,a) SELECT 24,count(*) FROM timetztmp WHERE a >= '07:46:45 GMT+4';
INSERT INTO timetzcmp (r_id,a) SELECT 25,count(*) FROM timetztmp WHERE a > '07:46:45 GMT+4';
+SET client_min_messages = DEBUG1;
CREATE INDEX timetzidx ON timetztmp USING gist ( a );
+DEBUG: building index "timetzidx" on table "timetztmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX timetzidx_b ON timetztmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "timetzidx_b" on table "timetztmp" serially
+DROP INDEX timetzidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a < '07:46:45 GMT+3'::timetz ) q WHERE r_id=1 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a <= '07:46:45 GMT+3'::timetz ) q WHERE r_id=2 ;
375
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX uuididx ON uuidtmp USING gist ( a );
+DEBUG: building index "uuididx" on table "uuidtmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX uuididx_b ON uuidtmp USING gist ( a ) WITH (buffering=on);
+DEBUG: building index "uuididx_b" on table "uuidtmp" serially
+DROP INDEX uuididx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM uuidtmp WHERE a < '55e65ca2-4136-4a4b-ba78-cd3fe4678203'::uuid;
count
50
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX varbitidx ON varbittmp USING GIST ( a );
+DEBUG: building index "varbitidx" on table "varbittmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX varbitidx_b ON varbittmp USING GIST ( a ) WITH (buffering=on);
+DEBUG: building index "varbitidx_b" on table "varbittmp" serially
+DROP INDEX varbitidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM varbittmp WHERE a < '1110100111010'::varbit;
count
400
(1 row)
+SET client_min_messages = DEBUG1;
CREATE INDEX vcharidx ON vchartmp USING GIST ( text(a) );
+DEBUG: building index "vcharidx" on table "vchartmp" serially
+DEBUG: using sorted GiST build
+CREATE INDEX vcharidx_b ON vchartmp USING GIST ( text(a) ) WITH (buffering=on);
+DEBUG: building index "vcharidx_b" on table "vchartmp" serially
+DROP INDEX vcharidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM vchartmp WHERE a < '31b0'::varchar(32);
count
SELECT count(*) FROM bittmp WHERE a > '011011000100010111011000110000100';
+SET client_min_messages = DEBUG1;
CREATE INDEX bitidx ON bittmp USING GIST ( a );
+CREATE INDEX bitidx_b ON bittmp USING GIST ( a ) WITH (buffering=on);
+DROP INDEX bitidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM byteatmp WHERE a > '31b0';
+SET client_min_messages = DEBUG1;
CREATE INDEX byteaidx ON byteatmp USING GIST ( a );
+CREATE INDEX byteaidx_b ON byteatmp USING GIST ( a ) WITH (buffering=on);
+DROP INDEX byteaidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '21472.79' FROM moneytmp ORDER BY a <-> '21472.79' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX moneyidx ON moneytmp USING gist ( a );
+CREATE INDEX moneyidx_b ON moneytmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX moneyidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32);
+SET client_min_messages = DEBUG1;
CREATE INDEX charidx ON chartmp USING GIST ( a );
+CREATE INDEX charidx_b ON chartmp USING GIST ( a ) WITH (buffering=on);
+DROP INDEX charidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM cidrtmp WHERE a > '121.111.63.82';
+SET client_min_messages = DEBUG1;
CREATE INDEX cidridx ON cidrtmp USING gist ( a );
+CREATE INDEX cidridx_b ON cidrtmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX cidridx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '2001-02-13' FROM datetmp ORDER BY a <-> '2001-02-13' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX dateidx ON datetmp USING gist ( a );
+CREATE INDEX dateidx_b ON datetmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX dateidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM enumtmp WHERE a > 'g'::rainbow;
+SET client_min_messages = DEBUG1;
CREATE INDEX enumidx ON enumtmp USING gist ( a );
+CREATE INDEX enumidx_b ON enumtmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX enumidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '-179.0' FROM float4tmp ORDER BY a <-> '-179.0' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX float4idx ON float4tmp USING gist ( a );
+CREATE INDEX float4idx_b ON float4tmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX float4idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX float8idx ON float8tmp USING gist ( a );
+CREATE INDEX float8idx_b ON float8tmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX float8idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM inettmp WHERE a > '89.225.196.191';
+SET client_min_messages = DEBUG1;
CREATE INDEX inetidx ON inettmp USING gist ( a );
+CREATE INDEX inetidx_b ON inettmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX inetidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '237' FROM int2tmp ORDER BY a <-> '237' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX int2idx ON int2tmp USING gist ( a );
+CREATE INDEX int2idx_b ON int2tmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX int2idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '237' FROM int4tmp ORDER BY a <-> '237' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX int4idx ON int4tmp USING gist ( a );
+CREATE INDEX int4idx_b ON int4tmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX int4idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX int8idx ON int8tmp USING gist ( a );
+CREATE INDEX int8idx_b ON int8tmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX int8idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21:21:23' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX intervalidx ON intervaltmp USING gist ( a );
+CREATE INDEX intervalidx_b ON intervaltmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX intervalidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM macaddrtmp WHERE a > '22:00:5c:e5:9b:0d';
+SET client_min_messages = DEBUG1;
CREATE INDEX macaddridx ON macaddrtmp USING gist ( a );
+CREATE INDEX macaddridx_b ON macaddrtmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX macaddridx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM macaddr8tmp WHERE a > '22:00:5c:e5:9b:0d';
+SET client_min_messages = DEBUG1;
CREATE INDEX macaddr8idx ON macaddr8tmp USING gist ( a );
+CREATE INDEX macaddr8idx_b ON macaddr8tmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX macaddr8idx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM numerictmp WHERE a > 0 ;
+SET client_min_messages = DEBUG1;
CREATE INDEX numericidx ON numerictmp USING gist ( a );
+CREATE INDEX numericidx_b ON numerictmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX numericidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM oidtmp WHERE oid > 17;
+SET client_min_messages = DEBUG1;
CREATE INDEX oididx ON oidtmp USING gist ( oid );
+CREATE INDEX oididx_b ON oidtmp USING gist ( oid ) WITH (buffering=on);
+DROP INDEX oididx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM texttmp WHERE a > '31b0';
+SET client_min_messages = DEBUG1;
CREATE INDEX textidx ON texttmp USING GIST ( a );
+CREATE INDEX textidx_b ON texttmp USING GIST ( a ) WITH (buffering=on);
+DROP INDEX textidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '10:57:11' FROM timetmp ORDER BY a <-> '10:57:11' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX timeidx ON timetmp USING gist ( a );
+CREATE INDEX timeidx_b ON timetmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX timeidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10-26 08:55:08' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX timestampidx ON timestamptmp USING gist ( a );
+CREATE INDEX timestampidx_b ON timestamptmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX timestampidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT a, a <-> '2018-12-18 10:59:54 GMT+2' FROM timestamptztmp ORDER BY a <-> '2018-12-18 10:59:54 GMT+2' LIMIT 3;
+SET client_min_messages = DEBUG1;
CREATE INDEX timestamptzidx ON timestamptztmp USING gist ( a );
+CREATE INDEX timestamptzidx_b ON timestamptztmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX timestamptzidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
+SET client_min_messages = DEBUG1;
CREATE INDEX timetzidx ON timetztmp USING gist ( a );
+CREATE INDEX timetzidx_b ON timetztmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX timetzidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM uuidtmp WHERE a > '55e65ca2-4136-4a4b-ba78-cd3fe4678203';
+SET client_min_messages = DEBUG1;
CREATE INDEX uuididx ON uuidtmp USING gist ( a );
+CREATE INDEX uuididx_b ON uuidtmp USING gist ( a ) WITH (buffering=on);
+DROP INDEX uuididx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM varbittmp WHERE a > '1110100111010';
+SET client_min_messages = DEBUG1;
CREATE INDEX varbitidx ON varbittmp USING GIST ( a );
+CREATE INDEX varbitidx_b ON varbittmp USING GIST ( a ) WITH (buffering=on);
+DROP INDEX varbitidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
SELECT count(*) FROM vchartmp WHERE a > '31b0'::varchar(32);
+SET client_min_messages = DEBUG1;
CREATE INDEX vcharidx ON vchartmp USING GIST ( text(a) );
+CREATE INDEX vcharidx_b ON vchartmp USING GIST ( text(a) ) WITH (buffering=on);
+DROP INDEX vcharidx_b;
+RESET client_min_messages;
SET enable_seqscan=off;
/*
* Sort all data, build the index from bottom up.
*/
+ elog(DEBUG1, "using sorted GiST build");
buildstate.sortstate = tuplesort_begin_index_gist(heap,
index,
maintenance_work_mem,