1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-22 02:52:08 +03:00

Fix parsing NOT sequence in tsquery

Digging around bug #14245 I found that commit
6734a1cacd 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
This commit is contained in:
Teodor Sigaev
2016-07-15 20:01:41 +03:00
parent 19d290155d
commit 00f304ce2d
3 changed files with 45 additions and 1 deletions

View File

@ -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)--;