I was thinking the very same thing. If it is a must to always bump up sort_mem before running restore why can't the restore utility do it? Take a portion of the currently available memory or ask a user interactively etc.This would need to be a command line option, because there may be systems on which bumping up sort_mem should not be done, for reasons unrelated to performance during the restore, and the restore may not always be done interactively.