Re: pg_dump --with-* options

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql(at)j-davis(dot)com
Subject: Re: pg_dump --with-* options
Date: 2025-06-12 13:47:54
Message-ID: 17f63ecf-679c-4337-817f-908bb159701f@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06.06.25 17:39, Nathan Bossart wrote:
> On Fri, Jun 06, 2025 at 09:14:32AM +0200, Peter Eisentraut wrote:
>> We have
>>
>> -a, --data-only dump only the data, not the schema or statistics
>> --no-data do not dump data
>> --with-data dump the data # this one is new
>>
>> (and there is also --section=data), and then three analogous options for
>> "schema" and "statistics".
>>
>> What is the purpose of the --with-data option? Dumping the data is the
>> default. Is this to override an earlier --no-data option?
>
> I believe the idea is that these will allow folks to be explicit about what
> they want instead of needing to understand the defaults for every
> component.

I get that idea, but we really need some more documentation for this, I
think. So far I could only guess how this is supposed to be used, and I
also happened to guess wrong.

My initial guess was that --with-data can override --no-data. That
would have been pretty standard "last option wins" behavior. But
pg_dump rejects that. Personally, I think that is kind of wrong.

But you can use --with-data to override, say, --schema-only. That also
seems kind of wrong to me, but anyway. Then, it seems that
--schema-only plus --with-data is kind of the same as everything plus
--no-statistics?

I'm also wondering, if you consider the aforementioned "last option
wins" behavior, should there be a difference between

--schema-only --with-data, and
--with-data --schema-only

or for that matter

--schema-only --data-only

But in any case, if you want that level of precision, wouldn't it make
more sense to use the --section option?

This is all a nice logic puzzle, but some more documentation would be nice.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-06-12 13:57:38 Re: Non-reproducible AIO failure
Previous Message Robert Haas 2025-06-12 13:35:11 Re: Inconsistent Behavior in JSONB Numeric Array Deletion