Thread
Commits
-
pg_dumpall: Skip global objects with --statistics-only or --no-schema.
- 48c2c7b4b45b 19 (unreleased) landed
- 973caf7291c1 18.0 landed
-
pg_dumpall dumps global objects with --statistics-only or --no-schema
Fujii Masao <masao.fujii@oss.nttdata.com> — 2025-06-24T15:26:12Z
Hi, While testing pg_dumpall in v18, I noticed that it still dumps global objects such as roles and tablespaces even when --statistics-only or --no-schema is specified. This seems unexpected. Since pg_dumpall treats global objects as schema-level content, it currently includes them with --schema-only but skips them with --data-only. By that logic, it should also skip them when either --statistics-only or --no-schema is used. Thought? Attached is a patch to fix this behavior. Originally, I planned to work on this after we settled the ongoing discussion about pg_dump options in [1], but since that may take some time, I wanted to bring this up now so I don't forget the issue. Regards, [1] https://postgr.es/m/7cc52488-f876-4ad3-affd-6e4b0ef0cb09@eisentraut.org -- Fujii Masao NTT DATA Japan Corporation
-
Re: pg_dumpall dumps global objects with --statistics-only or --no-schema
Corey Huinker <corey.huinker@gmail.com> — 2025-06-30T20:44:41Z
> > > Since pg_dumpall treats global objects as schema-level content, it > currently > includes them with --schema-only but skips them with --data-only. By that > logic, > it should also skip them when either --statistics-only or --no-schema is > used. > Thought? > > +1, pending resolution of the defaults issue. At first glance, this looks like a good candidate for the the same refactor that we did to pg_dump in 96a81c1be929, where we abandoned using the schema_only and data_only flags to determine what should be dumped in favor of dumpSchema, dumpData, and eventually dumpStatistics. This made for a cleaner interface because each test was described in terms of what was wanted, not in terms of the opposite being not the case, and all of the double/triple-negative boolean backflips were concentrated right after the options conflict resolutions. However, all prospective do_this_thing branches are used exactly once, so there is no code savings to be had and no clarity to be gained, so this patch is fine as is.
-
Re: pg_dumpall dumps global objects with --statistics-only or --no-schema
Jeff Davis <pgsql@j-davis.com> — 2025-07-16T17:03:44Z
On Mon, 2025-06-30 at 16:44 -0400, Corey Huinker wrote: > > > > Since pg_dumpall treats global objects as schema-level content, it > > currently > > includes them with --schema-only but skips them with --data-only. > > By that logic, > > it should also skip them when either --statistics-only or --no- > > schema is used. Thank you. > > +1, pending resolution of the defaults issue. I went ahead and committed this as it clearly needs to be fixed. We can continue the options discussion. Regards, Jeff Davis