Stephan Szabo <sszabo@megazone.bigpanda.com> writes:
> I'm not sure that the HINT strings would be as meaningful in the middle of
> complicated select/update/etc queries, but that would be something to see.
That's pretty much my stumbling block too. The examples Fabien has
shown so far don't seem to me to be all that much more helpful than a
simple facility to show the "\h command" syntax summary. Now "\h"
doesn't know anything about syntax errors within expressions, and so
I'm prepared to believe that there's some gold to be mined here if we
can get the parser to offer useful hints in the context of complex
expressions. What I've not seen yet is any proof that that can be done
at all, much less at a reasonable cost in terms of grammar complexity...
> I'm not sure it's PostgreSQL's responsibility to teach SQL or even really
> to teach our own commands, but if it were possible to do without much of a
> performance, readability or maintenance cost, it'd probably be worth
> doing.
Right; we have to consider those costs and trade them off against the
benefit of better error reporting.
One thought here is that the extra costs might be better spent in a
client program that's in a "training wheels" mode. Would it be
reasonable to invent a "psql-student" client that has its own version of
the parser with better error detection? Then production clients
wouldn't have to pay any cycles towards support of novices. I'm not
sure right now how hard it would be to keep such a client in sync with
the production backend, but it's an idea to consider...
regards, tom lane