After digesting the discussion, let's reshuffle this a bit.
I have committed the change that adds the error location in one place.
That worked independently.
Attached is a new patch that refactors things a bit to pass the
ParseState into functions such as PrepareQuery() and ExecuteQuery()
instead of passing the query string and query environment as a separate
arguments. We had already done that for most utility commands; there
were just some left that happened to be involved in the current thread's
discussion anyway.
That's a nice cosmetic improvement in any case, but I think that it
would also help with the issue of passing parameters into some utility
commands later on. I will look into that some other time.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services