"Kevin O'Gorman" <kogorman@pacbell.net> writes:
>> Don't you get shift/reduce errors if you remove those precedence specs?
>> I'd expect the <select_clause> grammar to be ambiguous without operator
>> precedence specs ...
> Yah. I would have thought so too. However, when I comment out the
> two %left lines (being careful not to dusturb line numbers) I get the
> absolutely identical gram.c output. So at least for those two things
> the associativity does nothing at all. I'm inclined to leave them commented
> out, so they don't mislead.
Not to put too fine a point on it, but are you talking about the
original grammar or your modified one? Your modified one is erroneous
because it will always associate successive UNION/INTERSECT/EXCEPT
operators left-to-right; this does not meet the SQL spec which insists
that INTERSECT binds more tightly than the other two. Given that, I'm
not surprised that the precedences have no effect.
> I don't see precedence in SQL92; set operations
> seem to be left associative of equal priority.
Better take another look at the <query expression>, <query term>,
<query primary> hierarchy then...
regards, tom lane