qr/\Qpg_dump: error: -Z\/--compress must be in range 0..9\E/,
    'pg_dump: -Z/--compress must be in range');
 
+if (check_pg_config("#define HAVE_LIBZ 1"))
+{
+   command_fails_like(
+       [ 'pg_dump', '--compress', '1', '--format', 'tar' ],
+       qr/\Qpg_dump: error: compression is not supported by tar archive format\E/,
+       'pg_dump: compression is not supported by tar archive format');
+}
+else
+{
+   # --jobs > 1 forces an error with tar format.
+   command_fails_like(
+       [ 'pg_dump', '--compress', '1', '--format', 'tar', '-j3' ],
+       qr/\Qpg_dump: warning: requested compression not available in this installation -- archive will be uncompressed\E/,
+       'pg_dump: warning: compression not available in this installation');
+}
+
 command_fails_like(
    [ 'pg_dump', '--extra-float-digits', '-16' ],
    qr/\Qpg_dump: error: --extra-float-digits must be in range\E/,