mirror of
https://github.com/postgres/postgres.git
synced 2025-05-12 00:01:58 -04:00
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.
This commit is contained in:
parent
10de92f87f
commit
b053c53248
@ -189,8 +189,8 @@ makepol(WORKSTATE * state)
|
|||||||
case OPEN:
|
case OPEN:
|
||||||
if (makepol(state) == ERR)
|
if (makepol(state) == ERR)
|
||||||
return ERR;
|
return ERR;
|
||||||
if (lenstack && (stack[lenstack - 1] == (int4) '&' ||
|
while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
|
||||||
stack[lenstack - 1] == (int4) '!'))
|
stack[lenstack - 1] == (int4) '!'))
|
||||||
{
|
{
|
||||||
lenstack--;
|
lenstack--;
|
||||||
pushquery(state, OPR, stack[lenstack]);
|
pushquery(state, OPR, stack[lenstack]);
|
||||||
|
@ -234,8 +234,8 @@ makepol(QPRS_STATE * state)
|
|||||||
case OPEN:
|
case OPEN:
|
||||||
if (makepol(state) == ERR)
|
if (makepol(state) == ERR)
|
||||||
return ERR;
|
return ERR;
|
||||||
if (lenstack && (stack[lenstack - 1] == (int4) '&' ||
|
while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
|
||||||
stack[lenstack - 1] == (int4) '!'))
|
stack[lenstack - 1] == (int4) '!'))
|
||||||
{
|
{
|
||||||
lenstack--;
|
lenstack--;
|
||||||
pushquery(state, OPR, stack[lenstack], 0, 0, 0);
|
pushquery(state, OPR, stack[lenstack], 0, 0, 0);
|
||||||
|
@ -396,8 +396,8 @@ makepol(QPRS_STATE * state, void (*pushval) (QPRS_STATE *, int, char *, int, int
|
|||||||
case OPEN:
|
case OPEN:
|
||||||
if (makepol(state, pushval) == ERR)
|
if (makepol(state, pushval) == ERR)
|
||||||
return ERR;
|
return ERR;
|
||||||
if (lenstack && (stack[lenstack - 1] == (int4) '&' ||
|
while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
|
||||||
stack[lenstack - 1] == (int4) '!'))
|
stack[lenstack - 1] == (int4) '!'))
|
||||||
{
|
{
|
||||||
lenstack--;
|
lenstack--;
|
||||||
pushquery(state, OPR, stack[lenstack], 0, 0, 0);
|
pushquery(state, OPR, stack[lenstack], 0, 0, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user