From 8559dea1f6ae1a566adb70ab0f4b94aee2f60e3f Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Sun, 20 Apr 2008 09:17:57 +0000 Subject: [PATCH] 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. --- src/backend/utils/adt/tsquery_gist.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/utils/adt/tsquery_gist.c b/src/backend/utils/adt/tsquery_gist.c index eb97baa360..d3b46a3af8 100644 --- a/src/backend/utils/adt/tsquery_gist.c +++ b/src/backend/utils/adt/tsquery_gist.c @@ -106,8 +106,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 -- 2.39.5