Fix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by
authorTeodor Sigaev <teodor@sigaev.ru>
Tue, 28 Jul 2009 09:31:55 +0000 (09:31 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Tue, 28 Jul 2009 09:31:55 +0000 (09:31 +0000)
 Aaron Marcuse-Kubitza <aaronmk@blackducksoftware.com>

src/backend/utils/adt/tsquery_rewrite.c

index 5859fd3f83840c695ddef51b9330bc1ef8974a33..196a3779f9944700dfb1d7b2f457dc6edefa7804 100644 (file)
@@ -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];