pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rework code defining default compression for dir/custom formats
Date: Thu, 27 Apr 2023 04:36:22 +0000
Message-ID: <E1prtMj-0056i1-LT@gemulon.postgresql.org> (raw)

Rework code defining default compression for dir/custom formats in pg_dump

As written, pg_dump would call twice parse_compress_specification() for
the custom and directory formats to build a compression specification if
no compression option is defined, as these formats should be compressed
by default when compiled with zlib, or use no compression without zlib.
This made the code logic quite confusing, and the first compression
specification built would be incorrect before being overwritten by the
second one.

Rather than creating two compression specifications, this commit changes
a bit the order of the checks for the compression options so as
compression_algorithm_str is now set to a correct value for the custom
and format directory when no compression option is defined.  This makes
the code easier to understand, as parse_compress_specification() is now
called once for all the format, with or without user-specified
compression methods.  One comment was also confusing for the non-zlib
case, so remove it while on it.

This code has been introduced in 5e73a60 when adding support for
compression specifications in pg_dump.

Per discussion with Justin Pryzby and Georgios Kokolatos.

Discussion: https://postgr.es/m/20230225050214.GH1653@telsasoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bedc1f0564d12c4a89fc9de3044201166542dc3d

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)



Message-ID: <E1prtMj-0056i1-LT@gemulon.postgresql.org>
Permalink:  ../E1prtMj-0056i1-LT@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1prtMj-0056i1-LT@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Rework code defining default compression for dir/custom formats
  In-Reply-To: <E1prtMj-0056i1-LT@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox