• Tom Lane's avatar
    Fix grammar for subscripting or field selection from a sub-SELECT result. · 670a6c7a
    Tom Lane authored
    Such cases should work, but the grammar failed to accept them because of
    our ancient precedence hacks to convince bison that extra parentheses
    around a sub-SELECT in an expression are unambiguous.  (Formally, they
    *are* ambiguous, but we don't especially care whether they're treated as
    part of the sub-SELECT or part of the expression.  Bison cares, though.)
    Fix by adding a redundant-looking production for this case.
    
    This is a fine example of why fixing shift/reduce conflicts via
    precedence declarations is more dangerous than it looks: you can easily
    cause the parser to reject cases that should work.
    
    This has been wrong since commit 3db4056e
    or maybe before, and apparently some people have been working around it
    by inserting no-op casts.  That method introduces a dump/reload hazard,
    as illustrated in bug #7838 from Jan Mate.  Hence, back-patch to all
    active branches.
    670a6c7a
subselect.out 15.7 KB