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

contrib/tsearch2/query_rewrite.c

index 63d8140a6c296863cf8b87cee64cf1bda43102a5..2b9173731120eddd1abd08ef0ede87a13d386212 100644 (file)
@@ -174,12 +174,12 @@ dropvoidsubtree(QTNode * root)
 
                root->nchild = j;
 
-               if (root->valnode->val == (int4) '!' && root->nchild == 0)
+               if (root->nchild == 0)
                {
                        QTNFree(root);
                        root = NULL;
                }
-               else if (root->nchild == 1)
+               else if (root->nchild == 1 && root->valnode->val != (int4) '!')
                {
                        QTNode     *nroot = root->child[0];