"Guillaume Smet" <guillaume.smet@gmail.com> writes:
> That's not what I had in mind. I was asking if the text of the query
> was available when logging the temp file usage. If so it could be good
> to add a DETAIL line with it directly and systematically when logging
> the temp file usage.
(1) you could make that argument about *any* log message whatsoever.
(2) there is already a generalized solution to this, it's called
log_min_error_statement.
regards, tom lane