aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/tsquery_op.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2008-03-07 15:29:27 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2008-03-07 15:29:27 +0000
commitb7a2ab5b6ea0eee67f5e0fa6ea6a8faef4ddac6f (patch)
tree1b1a657e78c46c5736b222a1aa7293be56be7da2 /src/backend/utils/adt/tsquery_op.c
parentffeae03742eefaeaa2a2bc2c41a46853fc4d71d2 (diff)
downloadpostgresql-b7a2ab5b6ea0eee67f5e0fa6ea6a8faef4ddac6f.tar.gz
postgresql-b7a2ab5b6ea0eee67f5e0fa6ea6a8faef4ddac6f.zip
Fix memory arrangement of tsquery after removing stop words. It causes
a unused memory holes in tsquery. Per report by Richard Huxton <dev@archonet.com>. It was working well because in fact tsquery->size is not used for any kind of operation except comparing tsqueries. To prevent requirement of renew all stored tsquery optimization in CompareTSQ is removed.
Diffstat (limited to 'src/backend/utils/adt/tsquery_op.c')
-rw-r--r--src/backend/utils/adt/tsquery_op.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/backend/utils/adt/tsquery_op.c b/src/backend/utils/adt/tsquery_op.c
index bf50b9d4c31..3e5b8d30057 100644
--- a/src/backend/utils/adt/tsquery_op.c
+++ b/src/backend/utils/adt/tsquery_op.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_op.c,v 1.3 2008/01/01 19:45:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_op.c,v 1.3.2.1 2008/03/07 15:29:27 teodor Exp $
*
*-------------------------------------------------------------------------
*/
@@ -141,27 +141,14 @@ tsquery_not(PG_FUNCTION_ARGS)
static int
CompareTSQ(TSQuery a, TSQuery b)
{
- if (a->size != b->size)
- {
- return (a->size < b->size) ? -1 : 1;
- }
- else if (VARSIZE(a) != VARSIZE(b))
- {
- return (VARSIZE(a) < VARSIZE(b)) ? -1 : 1;
- }
- else
- {
- QTNode *an = QT2QTN(GETQUERY(a), GETOPERAND(a));
- QTNode *bn = QT2QTN(GETQUERY(b), GETOPERAND(b));
- int res = QTNodeCompare(an, bn);
-
- QTNFree(an);
- QTNFree(bn);
+ QTNode *an = QT2QTN(GETQUERY(a), GETOPERAND(a));
+ QTNode *bn = QT2QTN(GETQUERY(b), GETOPERAND(b));
+ int res = QTNodeCompare(an, bn);
- return res;
- }
+ QTNFree(an);
+ QTNFree(bn);
- return 0;
+ return res;
}
Datum