Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1ekn-000ULG-06 for pgsql-hackers@arkaria.postgresql.org; Sun, 15 Mar 2026 06:15:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w1ekk-003eE3-0i for pgsql-hackers@arkaria.postgresql.org; Sun, 15 Mar 2026 06:15:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1ekj-003eDu-2l for pgsql-hackers@lists.postgresql.org; Sun, 15 Mar 2026 06:15:06 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w1ekh-00000000ECh-2GJ4 for pgsql-hackers@postgresql.org; Sun, 15 Mar 2026 06:15:06 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-661be3380adso6150136a12.3 for ; Sat, 14 Mar 2026 23:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773555303; cv=none; d=google.com; s=arc-20240605; b=EgzlIpBR9+3uF850D3G82FRTqxsJ+fx19V+kc9ucR1EOD8tUoQd8mFMBkMGVrOMt/y 5RHnzXLyctbrqPjy282Ctm1xBxsSg0WCwGipOeVmag/+15OxHrfBG6U+6kaI0M8LRki2 kDfn3X4NxL4XsHcr+qjeGvpHc1pfM7ciSDTw5gBWXRn/zpXIiFPqvcxsZTyoVCELOMLt YgQAyWsDuCws6jfIK/oL3t750dVsTsVImVePp3hhsn7ydyX/gln0v+ua0x0vzSUh6v4D UeYo2uJ9+AGhXJRoYjS3Je7AC94HLi+pM+OFeeqRX8eVFEx2fPuLNwSwybHhqB5PfwCJ Al/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=B/NfVijjtqiny0i0pmQIywGAbT2DtUlmmKMFcjF3Mn8=; fh=iVckEJPq4+98ThdJ9s+nSi8REQk0IpSoq0TbboLMnlc=; b=X9ZR6HEEo7gAZXSRR+cD7l9Iw8fKebN8fockzTBq+8uPaGzJX+1HIUtGSwXfCDtFEv C8IskYsi2fNLUDOZQNGJmCybRT7mWdS6r2x5Bvx3gWTtp7wKKJbZiS4e+PeUsvPvNI2R CQ5xfqIhMAI1vlqYqcNcf2dz0dxb/FH3FVVvuzIgwnI/EjVhmm60HkaJLDzIEPxr6ArS bqRBDmg9UHwHLju/J4hkAycl3zc+i2EXOOWaxzaEWQawhX2iFoQSNr4gShZRk9Gykg2P WB65HKAX6JifNpz3nhuhr08BVlX4oPfqiXu9v6qc702hxOaKfTRYrWpsgUNgkPuZ4uXr O9CQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773555303; x=1774160103; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=B/NfVijjtqiny0i0pmQIywGAbT2DtUlmmKMFcjF3Mn8=; b=MjCMDVvojxobkKxNPoYSh/RfgvHGfOd15tIZ6ghj/boyvOp8Zf5yq4NKRbL25m8H77 JcEx9BJMiogu7UaoEOLY0cWYzygJ3LTIoOL0TSa8GKsKinW1lBAobXt1hJ6xyiNuk5Pq 2DQOlV9grwo9HPPY5we36nED0fWatFfTohWy+REK2CNggYb6H2ZqZu0ghdvf/6GDopfT mSTlw/jwaF2Kyw5Dq0YzKrxYZaUoTlMv8ZsMIqeOnlxBqkTwVBStDrMQMbjJ1kPIHKfU gQlWUpeV5hCkclYfiJfY9II45gXglVvfSXPBy7OYABR+aMs2Fu449KMZh/tyIGubFl+o 2avg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773555303; x=1774160103; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=B/NfVijjtqiny0i0pmQIywGAbT2DtUlmmKMFcjF3Mn8=; b=i2p+bS89JJH4irpUYmHnl+jcz7Muz/eJZ00GB0SHtORb4MQQZ1Cd4AWdxASMY0HxXs oiTrSAGHFVItyEAJORS6ap5/kP5pOM57W2CPujBniMdEnwYh4LGxf0/jNI0PBJnrNWK5 wdghXzXzYv052NpsvTeVkFQWqaA5Qdl9AMUIObKWEHvJ5Tu9VgajUiiMscqaSALetHIB 48Hz06hccRc79OzqYMtTs1aIbIAD2+eTMyrlUKY+ZMOy8cgQLmN5Pt5v1wRdVnysvVIF +K+7e+lbEZ26UnweZlh8V46Q9ZMAOQmJ3nDeUFF4w+Kxb+WMrwqzmk0L6KwPtbEMgJa9 3apw== X-Gm-Message-State: AOJu0YwPy4fu8qMo30sJbMjojAOUX0NuWuP0SJqMAYkG9EHfM+UDCtFq zhtx3rtKLe23ymulvVMFxEaxx4bhwckKGSKTZgO0SCtUsYs24q3aNgJodJy98le5k5UncTImAij pMYowgH+V0eW5TBQNvwICMHiVuDtiJfw= X-Gm-Gg: ATEYQzxko7i/ZjxckxpXWQqwcLf8cK7o5A33uD6iypWyJFGPaD3GlsNnl1lWkQVCPYn Zk5Q2KLrhGdviAiVnrcX6rwwAIp2x7BKzvtdWL5m8wgggKYk/eCKtAce4cSKJ9ihR9oGjUCwz/R +j5F5VI63uq1WPX7opraa6r4MnVN2xz3+ZlvPvuu/KoTDSLRqX4vTe9hmpDCf2Sk/xFK4/r1exV KwFBYqTq2NtLJ6QS0mm4r6hFWkiLQIW7Dc7cLw4WyRj2e2IzKWtzPs6YUd+cieDlVAH0mfC52fA MIQaDKQsNkhOYKSzCbfSyHDMxfC9I5aE3yp62AhXUichq+GQb6cIt6SUYo/TyAJfScFFBPM6iuM 5kgrfzlkXWEqawPxYEpdUgctxGA== X-Received: by 2002:a17:907:3daa:b0:b97:a086:ac9d with SMTP id a640c23a62f3a-b97a086d3f9mr175978866b.43.1773555302393; Sat, 14 Mar 2026 23:15:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Srinath Reddy Sadipiralla Date: Sun, 15 Mar 2026 11:44:50 +0530 X-Gm-Features: AaiRm53J8t5cbfReUkvvhhFolEI_oFp58g1AAon9yXZIHttKP3MI-T-8aFWcpJ0 Message-ID: Subject: Re: bug: pg_dumpall with --data-only and --clean options is giving an error after some dump To: Mahendra Singh Thalor Cc: PostgreSQL-development Content-Type: multipart/alternative; boundary="000000000000c9e9c6064d0a0590" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c9e9c6064d0a0590 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, On Sun, Mar 15, 2026 at 12:49=E2=80=AFAM Mahendra Singh Thalor wrote: > Hi all, > > I was doing some tests with pg_dump, pg_dumpall and pg_restore tools. Wit= h > "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 ZQDDv56JBW8CVfkLsRDeyRpBvDGYUeqhZbJkDccKbXG8q6PI4RB69Dd8KaqcWM= Y >> >> SET default_transaction_read_only =3D off; >> >> SET client_encoding =3D 'UTF8'; >> SET standard_conforming_strings =3D 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. > +1 for the fix , as it immediately throws an error in pg_dumpall itself, instead of going through all the way until pg_dump and then finding out it's not a correct combination of options. I have reviewed,tested the patch , except these it LGTM. 1) maybe match the pg_dumpall comment with the pg_dump comment. 2) please fix the indentation using pgindent diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index 47a062d0160..b47e683e1d4 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -455,9 +455,9 @@ main(int argc, char *argv[]) schema_only, "-s/--schema-only", tablespaces_only, "-t/--tablespaces-only"); - /* --clean and --data-only are incompatible */ + /* --clean is incompatible with --data-only */ check_mut_excl_opts(output_clean, "-c/--clean", - data_only, "-a/--data-only"); + data_only, "-a/--data-only"); if (if_exists && !output_clean) pg_fatal("option %s requires option %s", --=20 Thanks, Srinath Reddy Sadipiralla EDB: https://www.enterprisedb.com/ --000000000000c9e9c6064d0a0590 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

On Sun, Mar 1= 5, 2026 at 12:49=E2=80=AFAM Mahendra Singh Thalor <mahi6run@gmail.com> wrote:
Hi all,
=
I was doing some tests with pg_dump, pg_dumpall and pg_resto= re 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 ZQDDv56JBW8CVfkLsRDeyRpBvDGYUeqhZbJkDc= cKbXG8q6PI4RB69Dd8KaqcWMY

SET default_transaction_read_only =3D off;=

SET client_encoding =3D 'UTF8';
SET standard_conforming_= strings =3D on;

\unrestrict ZQDDv56JBW8CVfkLsRDeyRpBvDGYUeqhZbJkDccK= bXG8q6PI4RB69Dd8KaqcWMY

--
-- Databases
--

--
-- Dat= abase "template1" dump
--

pg_dump: error: options -c/--= clean and -a/--data-only cannot be used together
pg_dumpall: error: pg_d= ump failed on database "template1", exiting

<= div>
Error is coming from pg_dump but it should come from pg_= dumpall without any=C2=A0dump.

Here, I am attachin= g a patch to fix this problem. Please review this.
=

+1 for the fix , as it immediately throws an error in pg_dumpall i= tself,
instead of going through all the way until pg_dump and then findi= ng
out it's not a correct combination of options.

I have revi= ewed,tested the patch , except these it LGTM.
1) maybe match the pg_dump= all comment with the pg_dump comment.
2) please fix the indentation usin= g pgindent

diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_du= mp/pg_dumpall.c
index 47a062d0160..b47e683e1d4 100644
--- a/src/bin/p= g_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -455,9 +455= ,9 @@ main(int argc, char *argv[])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 schema_only, &q= uot;-s/--schema-only",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tablespaces_only, &quo= t;-t/--tablespaces-only");
=C2=A0
- =C2=A0 =C2=A0 =C2=A0 /* --cl= ean and --data-only are incompatible */
+ =C2=A0 =C2=A0 =C2=A0 /* --clea= n is incompatible with --data-only */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 check_= mut_excl_opts(output_clean, "-c/--clean",
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 data_only, &quo= t;-a/--data-only");
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 data_only, "-a/--data-only&q= uot;);
=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (if_exists && !o= utput_clean)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pg_= fatal("option %s requires option %s",

<= span class=3D"gmail_signature_prefix">--
T= hanks,
Srinath Reddy Sadipiralla
<= span style=3D"color:rgb(34,34,34)">EDB:=C2=A0https:/= /www.enterprisedb.com/
--000000000000c9e9c6064d0a0590--