From: Teodor Sigaev Date: Sun, 20 Apr 2008 09:29:48 +0000 (+0000) Subject: Fix broken compare function for tsquery_ops. Per Tom's report. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=014ea5ca8e30f42555327e8f48b99ad8a5fbe81f;p=users%2Fbernd%2Fpostgres.git Fix broken compare function for tsquery_ops. Per Tom's report. I never understood why initial authors GiST in pgsql choose so stgrange signature for 'same' method: bool *sameFn(Datum a, Datum b, bool* result) instead of simple, logical bool sameFn(Datum a, Datum b) This change will break any existing GiST extension, so we still live with it and will live. --- diff --git a/src/backend/utils/adt/tsquery_gist.c b/src/backend/utils/adt/tsquery_gist.c index eb92bffa38..586e8a22e3 100644 --- a/src/backend/utils/adt/tsquery_gist.c +++ b/src/backend/utils/adt/tsquery_gist.c @@ -101,8 +101,11 @@ gtsquery_same(PG_FUNCTION_ARGS) { TSQuerySign *a = (TSQuerySign *) PG_GETARG_POINTER(0); TSQuerySign *b = (TSQuerySign *) PG_GETARG_POINTER(1); + bool *result = (bool *) PG_GETARG_POINTER(2); - PG_RETURN_POINTER(*a == *b); + *result = (*a == *b) ? true : false; + + PG_RETURN_POINTER(result); } static int