Tom,
> I have occasionally toyed with the idea of labeling querytree
> elements
> with back-pointers showing the segment of source text that they came
> from, but AFAICT this would impose a nontrivial cost on parsing
> activity
> --- a cost that'd be paid all the time, even on correct queries. Not
> sure if it'd be a net benefit or not.
I'd suggest it as a compile-time option, if that's feasable. This is
only a concern, IME, for development machines. On a production
machine, presumably all of the queries and functions are already
tested.
Thus, if we had the compile-time option of --explicit-query-errors then
it would add this functionality for testers without slowing down
PostgreSQL overall. Don't know if compile-time options for the parser
are reasonable, though. Also, I would personally rate this below
several other improvement projects in priority, such as in-database
replication, point-in-time recovery and nested transactions.
-Josh Berkus