bug: pg_dumpall with --data-only and --clean options is giving an error after some dump

From: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: bug: pg_dumpall with --data-only and --clean options is giving an error after some dump
Date: 2026-03-14 19:18:39
Message-ID: CAKYtNArrHiJ0LDB9BFZiUWs6tC78QkBN50wiwO07WhxewYDS3Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I was doing some tests with pg_dump, pg_dumpall and pg_restore tools. With
"pg_dumpall --data-only --clean", we are reporting an error after dumping
some data.

Please see the example below.

./pg_dumpall --data-only --clean
> --
> -- PostgreSQL database cluster dump
> --
>
> \restrict ZQDDv56JBW8CVfkLsRDeyRpBvDGYUeqhZbJkDccKbXG8q6PI4RB69Dd8KaqcWMY
>
> SET default_transaction_read_only = off;
>
> SET client_encoding = 'UTF8';
> SET standard_conforming_strings = on;
>
> \unrestrict ZQDDv56JBW8CVfkLsRDeyRpBvDGYUeqhZbJkDccKbXG8q6PI4RB69Dd8KaqcWMY
>
> --
> -- Databases
> --
>
> --
> -- Database "template1" dump
> --
>
> pg_dump: error: options -c/--clean and -a/--data-only cannot be used
> together
> pg_dumpall: error: pg_dump failed on database "template1", exiting
>
>
Error is coming from pg_dump but it should come from pg_dumpall without
any dump.

Here, I am attaching a patch to fix this problem. Please review this.

--
Thanks and Regards
Mahendra Singh Thalor
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
v01-pg_dumpall-clean-and-data-only-are-incompatible.patch text/x-patch 1.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2026-03-14 19:51:29 Re: Import Statistics in postgres_fdw before resorting to sampling.
Previous Message Greg Burd 2026-03-14 18:59:30 Re: Areas for Solaris support modernization