Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Someone asked for that recently, and the email is in my mailbox for
> consideration. I think it is a great idea, and we have
> debug_query_string that holds the current query.
debug_query_string doesn't necessarily have a lot to do with the
proximate cause of the error. Consider queries issued by rules,
triggers, plpgsql functions, etc.
regards, tom lane