From 9b5c8d45f62bd3d243a40cc84deb93893f2f5122 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 14 Apr 2008 17:05:34 +0000 Subject: Push index operator lossiness determination down to GIST/GIN opclass "consistent" functions, and remove pg_amop.opreqcheck, as per recent discussion. The main immediate benefit of this is that we no longer need 8.3's ugly hack of requiring @@@ rather than @@ to test weight-using tsquery searches on GIN indexes. In future it should be possible to optimize some other queries better than is done now, by detecting at runtime whether the index match is exact or not. Tom Lane, after an idea of Heikki's, and with some help from Teodor. --- src/backend/utils/adt/tsquery_gist.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/backend/utils/adt/tsquery_gist.c') diff --git a/src/backend/utils/adt/tsquery_gist.c b/src/backend/utils/adt/tsquery_gist.c index fdefd92bae2..df813b59223 100644 --- a/src/backend/utils/adt/tsquery_gist.c +++ b/src/backend/utils/adt/tsquery_gist.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_gist.c,v 1.4 2008/01/01 19:45:53 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_gist.c,v 1.5 2008/04/14 17:05:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -52,12 +52,17 @@ Datum gtsquery_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); - TSQuerySign *key = (TSQuerySign *) DatumGetPointer(entry->key); TSQuery query = PG_GETARG_TSQUERY(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ + bool *recheck = (bool *) PG_GETARG_POINTER(4); + TSQuerySign *key = (TSQuerySign *) DatumGetPointer(entry->key); TSQuerySign sq = makeTSQuerySign(query); bool retval; + /* All cases served by this function are inexact */ + *recheck = true; + switch (strategy) { case RTContainsStrategyNumber: -- cgit v1.2.3