From: Nathan Bossart <nathandbossart@gmail.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: pg_dump --with-* options
Date: Wed, 25 Jun 2025 09:48:12 -0500
Message-ID: <aFwMLD7S8tbsafc3@nathan> (raw)
In-Reply-To: <3cc4f166-0b58-47e2-a03c-7c2873d62b14@oss.nttdata.com>
References: <CA+TgmoactJEUHeXuxHLKNXHzm6-XrQFigPur-4nHTMFSiSRkiQ@mail.gmail.com>
<aErpuM6RXSlK1FBW@nathan>
<7bf0246542713d80f12c738c1d365d1365750c18.camel@j-davis.com>
<5e398522803da9bf3f9fc33ca43084ec21ab0fcd.camel@j-davis.com>
<aFLenfMRS9jFINxq@nathan>
<031558c60e84362898922caa6a90587e7fdf2a57.camel@j-davis.com>
<CA+TgmoYW4ycbzZehdS9nOw60ZdtwzWZ-qoVpBe3+QCpeBxvKug@mail.gmail.com>
<aFrWvlsWwE92Mcpr@nathan>
<CA+TgmoYuP7TvwThJERO2X7CHJCrTMpiv=Fd=EPOcyWwL=8J4Hg@mail.gmail.com>
<3cc4f166-0b58-47e2-a03c-7c2873d62b14@oss.nttdata.com>
On Wed, Jun 25, 2025 at 08:18:28AM +0900, Fujii Masao wrote:
> For pg_dump and pg_dumpall, I agree with Jeff's idea in [1],
> but if the statistics is skipped by default, I don't think
> we need a --no-statistics option. So, here's how I think
> the options should work:
>
> * Keep: --schema-only, --data-only, --statistics-only, --no-schema, --no-data, -and -statistics
> * Remove: --no-statistics, --with-schema, and --with-data
> * Combinations:
> Schema + Data + Stats : --statistics
> Schema + Data : (default)
> Schema + Stats : --no-data --statistics
> Data + Stats : --no-schema --statistics
> Schema only : --schema-only (or --no-data)
> Data only : --data-only (or --no-schema)
> Stats only : --statistics-only (or --no-schema --no-data --statistics)
I believe this is equivalent to the second option I proposed upthread [0].
Jeff proposed a variation of this option that keeps --no-statistics around
so that we could more easily change the default for stats down the road
[1].
> As I mentioned in [2], if we treat --statistics in the similar way to
> --sequence-data, i.e., allow --statistics to be used with --schema-only
> or --data-only, we could simplify further:
>
> * Keep: --schema-only, --data-only, --statistics-only, and --statistics
> * Remove: --no-schema, --no-data, --no-statistics, --with-schema, and --with-data
> * Combinations:
> Schema + Data + Stats : --statistics
> Schema + Data : (default)
> Schema + Stats : --schema-only --statistics
> Data + Stats : --data-only --statistics
> Schema only : --schema-only
> Data only : --data-only
> Stats only : --statistics-only
>
> Some may find this confusing due to mixing --statistics with --schema-only
> or --data-only, so I understand if there's hesitation.
Hm. I didn't really intend for --sequence-data to set a precedent here.
That's mostly intended as a submode for --binary-upgrade. Perhaps we
should consider removing it as a documented option and instead convert it
to --binary-upgrade=sequence-data or something. In any case, allowing
"only" options to be used in conjunction with --statistics seems a little
confusing to me. But I'm not strongly opposed to the idea.
> For pg_restore, I believe there's agreement to restore statistics
> by default if they exist in the archive. So:
>
> * Keep: --schema-only, --data-only, --statistics-only, --no-schema, --no-data, and --no-statistics
> * Remove: --with-schema, --with-data, and --statistics
> * Combinations:
> Schema + Data + Stats : (default)
> Schema + Data : --no-statistics
> Schema + Stats : --no-data
> Data + Stats : --no-schema
> Schema only : --schema-only (or --no-data --no-statistics)
> Data only : --data-only (or --no-schema --no-statistics)
> Stats only : --statistics-only (or --no-schema --no-data)
+1
[0] https://postgr.es/m/aFLxvrh71VWqdL9A%40nathan
[1] https://postgr.es/m/031558c60e84362898922caa6a90587e7fdf2a57.camel%40j-davis.com
--
nathan
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-hackers@postgresql.org
Cc: nathandbossart@gmail.com, masao.fujii@oss.nttdata.com, robertmhaas@gmail.com, pgsql@j-davis.com, peter@eisentraut.org
Subject: Re: pg_dump --with-* options
In-Reply-To: <aFwMLD7S8tbsafc3@nathan>
* 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