pg_dumpall dumps global objects with --statistics-only or --no-schema

Fujii Masao <masao.fujii@oss.nttdata.com>

From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2025-06-24T15:26:12Z
Lists: pgsql-hackers

Attachments

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

Commits

  1. pg_dumpall: Skip global objects with --statistics-only or --no-schema.