This is the threatened second pass at reporting parse error locations.
It makes the majority of the ereport's in backend/parser/ include an
error location. It's not quite ready to apply, mainly because I haven't
prepared updated regression test outputs yet (something like 45 out of
the 115 existing tests will need changes, plus no doubt parts of
contrib).
There are some exceedingly useful (IMHO) improvements here --- for
example, if you have an aggregate in an illegal place, it'll point
right at the aggregate instead of just telling you there is one.
In a complex query with multiple levels of subquery this is not always
such an easy thing to know.
The main areas that are still lacking location information are errors
involving relation aliases and FOR UPDATE/FOR SHARE clauses. I'm not
all that excited about those cases, and I'm running out of time before
September commit fest; so barring objection I'm going to clean up and
commit what I have.
regards, tom lane