summaryrefslogtreecommitdiff
path: root/contrib/ltree/ltxtquery_io.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-12-19 12:48:41 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2010-12-19 12:48:41 -0500
commitaebddf00d2a11ed05a9eaadf3823a2e39bfaede1 (patch)
treeabc3ff9c5353041efcbe334cb775ea8e2aba3b1c /contrib/ltree/ltxtquery_io.c
parent8b4d3d44dc7d64aaafd2269d3da8d2873137c691 (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 'contrib/ltree/ltxtquery_io.c')
-rw-r--r--contrib/ltree/ltxtquery_io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/ltree/ltxtquery_io.c b/contrib/ltree/ltxtquery_io.c
index b158c4b4416..d9163babf74 100644
--- a/contrib/ltree/ltxtquery_io.c
+++ b/contrib/ltree/ltxtquery_io.c
@@ -241,8 +241,8 @@ makepol(QPRS_STATE *state)
case OPEN:
if (makepol(state) == ERR)
return ERR;
- if (lenstack && (stack[lenstack - 1] == (int4) '&' ||
- stack[lenstack - 1] == (int4) '!'))
+ while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
+ stack[lenstack - 1] == (int4) '!'))
{
lenstack--;
pushquery(state, OPR, stack[lenstack], 0, 0, 0);