At the time I didn't want to pursue it further because of Andres' pending work on redoing expression execution, but that's landed now.
regards, tom lane
For that matter, it's not totally clear what would constitute an improvement --- what do you wish it would show you, exactly?
It looks like that patch is about showing which value or where in the statement the error is being caused. At least for my case, it would be helpful to know which field is causing the error. And just guessing, but maybe simpler? I'd be happy to see:
The error text was: ERROR for field [field_name]: value too long for type character varying(10)