+1, this seems like it could be very useful. A somewhat related issue is being able to tie plan nodes back to the query text: it can be hard to understand the planner's decisions if it's not even clear what part of the query it's making decisions about. I'm sure this is not an easy problem in general, but I wonder if you think that could be improved in the course of this work, or if you have other thoughts about it.
Thanks, Maciek