From: Teodor Sigaev Date: Tue, 28 Jul 2009 09:31:55 +0000 (+0000) Subject: Fix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by X-Git-Tag: REL8_5_ALPHA1~93 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f4b046c188cd6f8eda4890f7f0e9d9974825d9b;p=postgresql Fix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by Aaron Marcuse-Kubitza --- diff --git a/src/backend/utils/adt/tsquery_rewrite.c b/src/backend/utils/adt/tsquery_rewrite.c index 981c729d95..d4f6733403 100644 --- a/src/backend/utils/adt/tsquery_rewrite.c +++ b/src/backend/utils/adt/tsquery_rewrite.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_rewrite.c,v 1.15 2009/07/16 06:33:44 petere Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_rewrite.c,v 1.16 2009/07/28 09:31:55 teodor Exp $ * *------------------------------------------------------------------------- */ @@ -217,12 +217,12 @@ dropvoidsubtree(QTNode *root) root->nchild = j; - if (root->valnode->qoperator.oper == OP_NOT && root->nchild == 0) + if (root->nchild == 0) { QTNFree(root); root = NULL; } - else if (root->nchild == 1) + else if (root->nchild == 1 && root->valnode->qoperator.oper != OP_NOT) { QTNode *nroot = root->child[0];