diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-12-19 12:48:41 -0500 | 
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-12-19 12:48:41 -0500 | 
| commit | aebddf00d2a11ed05a9eaadf3823a2e39bfaede1 (patch) | |
| tree | abc3ff9c5353041efcbe334cb775ea8e2aba3b1c /src | |
| parent | 8b4d3d44dc7d64aaafd2269d3da8d2873137c691 (diff) | |
Fix erroneous parsing of tsquery input "... & !(subexpression) | ..."
After parsing a parenthesized subexpression, we must pop all pending
ANDs and NOTs off the stack, just like the case for a simple operand.
Per bug #5793.
Also fix clones of this routine in contrib/intarray and contrib/ltree,
where input of types query_int and ltxtquery had the same problem.
Back-patch to all supported versions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/utils/adt/tsquery.c | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index c419e86ced8..f5c1650a10e 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -371,8 +371,8 @@ makepol(TSQueryParserState state,  			case PT_OPEN:  				makepol(state, pushval, opaque); -				if (lenstack && (opstack[lenstack - 1] == OP_AND || -								 opstack[lenstack - 1] == OP_NOT)) +				while (lenstack && (opstack[lenstack - 1] == OP_AND || +									opstack[lenstack - 1] == OP_NOT))  				{  					lenstack--;  					pushOperator(state, opstack[lenstack]); | 
