summaryrefslogtreecommitdiff
path: root/contrib/ltree
diff options
context:
space:
mode:
authorTom Lane2010-12-19 17:48:34 +0000
committerTom Lane2010-12-19 17:48:34 +0000
commitabc10262696e53773c9a8c9f279bbd464b464190 (patch)
tree9626bc02f37b0e92549fc815f6bedbba7f9728b9 /contrib/ltree
parentdcb09b595f88a3bca6097a6acc17bf2ec935d55f (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')
-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 e1240c3d2fe..826f4e1c9dd 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);