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

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: pg_dumpall dumps global objects with --statistics-only or --no-schema
Date: 2025-06-24 15:26:12
Message-ID: 08129593-6f3c-4fb9-94b7-5aa2eefb99b0@oss.nttdata.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v1-0001-pg_dumpall-Skip-global-objects-with-statistics-on.patch text/plain 1.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2025-06-24 15:30:02 Re: pgsql: Introduce pg_shmem_allocations_numa view
Previous Message Alexander Borisov 2025-06-24 15:20:39 Re: Improve the performance of Unicode Normalization Forms.