Invalid Argument piping tar output through gzip to tape

I ran into trouble trying to use pg_dump, the postgresql backup
utility, to back up databases to tape. Specifically, I wanted to
compress the data since it's often sparse and I didn't want to
waste increasingly-precious tape space.

This resulted in the dreaded Invalid argument response
only when writing to tape, and therefore in an incomplete archive
being written.

After significant digging around, I determined that I needed to
use dd to block the output of gzip for the tape. The manual
to gnu tar notes that tar does this automatically when it
pipes through gzip as a result of the -z option to tar. Using dd
is necessary after the gzip pipe if it's done separately, as is
necessary under pg_dump.