From: Teodor Sigaev Date: Tue, 28 Jul 2009 09:33:09 +0000 (+0000) Subject: Fix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by X-Git-Tag: REL8_2_14~16 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=a142498e76a74b64ea03b13809db96c7c5e6f62e;p=users%2Fgsingh%2Fpostgres.git Fix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by Aaron Marcuse-Kubitza --- diff --git a/contrib/tsearch2/query_rewrite.c b/contrib/tsearch2/query_rewrite.c index 63d8140a6c..2b91737311 100644 --- a/contrib/tsearch2/query_rewrite.c +++ b/contrib/tsearch2/query_rewrite.c @@ -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];