summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/tsquery.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2016-07-15 20:01:41 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2016-07-15 20:01:41 +0300
commit00f304ce2dd86f4b76606225b41e0854a3362628 (patch)
treeb7b40fde335f14c7938a17addbb5be4c7726f786 /src/backend/utils/adt/tsquery.c
parent19d290155d084754eeb5ebb2569654da06073ee8 (diff)
Fix parsing NOT sequence in tsquery
Digging around bug #14245 I found that commit 6734a1cacd44f5b731933cbc93182b135b167d0c missed that NOT operation is right associative in opposite to all other. This miss is resposible for tsquery parser fail on sequence of NOT operations
Diffstat (limited to 'src/backend/utils/adt/tsquery.c')
-rw-r--r--src/backend/utils/adt/tsquery.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c
index 72e608eb913..ab4aa7ca2d6 100644
--- a/src/backend/utils/adt/tsquery.c
+++ b/src/backend/utils/adt/tsquery.c
@@ -455,7 +455,9 @@ cleanOpStack(TSQueryParserState state,
while(*lenstack)
{
- if (opPriority > OP_PRIORITY(stack[*lenstack - 1].op))
+ /* NOT is right associative unlike to others */
+ if ((op != OP_NOT && opPriority > OP_PRIORITY(stack[*lenstack - 1].op)) ||
+ (op == OP_NOT && opPriority >= OP_PRIORITY(stack[*lenstack - 1].op)))
break;
(*lenstack)--;