From b053c532489a3fa1e01b196c15a0f14138ee9c3a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 19 Dec 2010 12:48:58 -0500 Subject: 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. --- contrib/intarray/_int_bool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'contrib/intarray/_int_bool.c') diff --git a/contrib/intarray/_int_bool.c b/contrib/intarray/_int_bool.c index 8517010e5ed..64c8e00e2f3 100644 --- a/contrib/intarray/_int_bool.c +++ b/contrib/intarray/_int_bool.c @@ -189,8 +189,8 @@ makepol(WORKSTATE * 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]); -- cgit v1.2.3