* tsquery_gist.c
* GiST index support for tsquery
*
- * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_gist.c,v 1.9 2009/06/11 14:49:04 momjian Exp $
+ * src/backend/utils/adt/tsquery_gist.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#include "access/skey.h"
+#include "access/stratnum.h"
#include "access/gist.h"
-#include "tsearch/ts_type.h"
#include "tsearch/ts_utils.h"
+#include "utils/builtins.h"
#define GETENTRY(vec,pos) DatumGetTSQuerySign((vec)->vector[pos].key)
gistentryinit(*retval, TSQuerySignGetDatum(sign),
entry->rel, entry->page,
- entry->offset, FALSE);
+ entry->offset, false);
}
PG_RETURN_POINTER(retval);
}
-Datum
-gtsquery_decompress(PG_FUNCTION_ARGS)
-{
- PG_RETURN_DATUM(PG_GETARG_DATUM(0));
-}
+/*
+ * We do not need a decompress function, because the other gtsquery
+ * support functions work with the compressed representation.
+ */
Datum
gtsquery_consistent(PG_FUNCTION_ARGS)
retval = (key & sq) != 0;
break;
default:
- retval = FALSE;
+ retval = false;
}
PG_RETURN_BOOL(retval);
}
typedef struct
{
OffsetNumber pos;
- int4 cost;
+ int32 cost;
} SPLITCOST;
static int
comparecost(const void *a, const void *b)
{
- if (((SPLITCOST *) a)->cost == ((SPLITCOST *) b)->cost)
+ if (((const SPLITCOST *) a)->cost == ((const SPLITCOST *) b)->cost)
return 0;
else
- return (((SPLITCOST *) a)->cost > ((SPLITCOST *) b)->cost) ? 1 : -1;
+ return (((const SPLITCOST *) a)->cost > ((const SPLITCOST *) b)->cost) ? 1 : -1;
}
#define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
j;
TSQuerySign datum_l,
datum_r;
- int4 size_alpha,
+ int32 size_alpha,
size_beta;
- int4 size_waste,
+ int32 size_waste,
waste = -1;
- int4 nbytes;
+ int32 nbytes;
OffsetNumber seed_1 = 0,
seed_2 = 0;
OffsetNumber *left,
PG_RETURN_POINTER(v);
}
+
+/*
+ * Formerly, gtsquery_consistent was declared in pg_proc.h with arguments
+ * that did not match the documented conventions for GiST support functions.
+ * We fixed that, but we still need a pg_proc entry with the old signature
+ * to support reloading pre-9.6 contrib/tsearch2 opclass declarations.
+ * This compatibility function should go away eventually.
+ */
+Datum
+gtsquery_consistent_oldsig(PG_FUNCTION_ARGS)
+{
+ return gtsquery_consistent(fcinfo);
+}