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 1w1lmO-000ajz-1P for pgsql-hackers@arkaria.postgresql.org; Sun, 15 Mar 2026 13:45:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w1lmM-004YCK-0r for pgsql-hackers@arkaria.postgresql.org; Sun, 15 Mar 2026 13:45:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1lmL-004YCC-2Z for pgsql-hackers@lists.postgresql.org; Sun, 15 Mar 2026 13:45:14 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w1lmJ-00000000FY0-3gJK for pgsql-hackers@lists.postgresql.org; Sun, 15 Mar 2026 13:45:13 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-b97bca3797dso6265466b.0 for ; Sun, 15 Mar 2026 06:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773582309; cv=none; d=google.com; s=arc-20240605; b=eq8rAmf2N8HqHgukZ5kFGHD95tu8vbFJo+P6oYoxZZep9Chk58N/CYav2Z0lQY9z6n e2iV8+b1/4hhAuj7r5TcpSF2nlRRlagw6YYS08hswTymgDTSnXmDGUEnJSPKIElLTbez fAp8O6Xz/07eNkdblG6PTl2e5oGwfExFD4QIqV/vWA7fH29EU4Gpkvmp5lAF4Ked0kdO pT/2OpWCCmKV+d5iFvDdcaegTVKmYm+lPfBX0gG7gBrgaRWMRrGqva/FmeuoUqsZETEF KGFcNpK8cwd7TItvzJWeRAuaWaMgygPnGQOC5GHAPgHfNkFnXBr8KYcKTW/UhFFoKBEv rZ7g== 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=erbhxmhj2B3zBY/9wlrPU3aYUcWSrjAR/N9Xrxkjc7o=; fh=6E3wt+7ZQufKyF2kF8Iw080Tgh6JpHy07taEbDFX5e0=; b=a5LPMrUC4v/AZAYjUQE53/erf6Qpz6eQNsOUxCpJDN6hO+JWelEZMusPPBtuooE3gZ OuLNpRpPGEV7CTWln+cKOr/cwG8sR3yQnkgUdrMJC9hMM44T7PGTpk78zk9Q03ed3esU Q2iv0NapgotYPAMREpyeZcvGwenDSaqoT2dB00tP9D1N3ubJ3/hPaQHgzxfKxcoNOni3 uhRnMLojRkmh+9qytVNAmI1PwoOQNlGuJzlmbzFPGQ2NEkQa1gWG3kt5G3JTjv65fVHt yXraDfoiCM8JIhCOMv2O6HC/5fYgYHNzB3+ncGjVgxCxnVhX95ejXpAktSCUEGl9xu62 BEGw==; darn=lists.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=1773582309; x=1774187109; darn=lists.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=erbhxmhj2B3zBY/9wlrPU3aYUcWSrjAR/N9Xrxkjc7o=; b=lrzC27GZpC7WIWkTsgbWk0xjueDnQAXqx1VBmtc0p9hEP5mRYglq4h65onOGeBBy8F TwHyMJKav58iIszYnZzKK7N5Czy+ZhGktXse/HM1T58kQhGYBeojm7TjMQHnSR7BmiMR ePukCPABR2fW4wgwP42586SjSryq6ElB/nLe2bAetan2HO+e12nz0P7nKLhIHNlG4k2F Vp/8XwKQukWNsQt10z7eGLV721VAWv/0N/9ONeDVa3kL/rIfsADeKDXXf70rKDEzTzsz rZhKmPAiXIiuZ2gY6bclUChdNYj/xVxMOr7Vuk9+Y7mIDfRJ2+KzDxaEzyvnMcpeqjnq yv3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773582309; x=1774187109; 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=erbhxmhj2B3zBY/9wlrPU3aYUcWSrjAR/N9Xrxkjc7o=; b=VbRQqFIzXCvsXJOT35KwIUiWAIyzCQXJQd703K2PT+Eu6NTklkXhoNlmguZjbiYESv 7RAgQX/eyAb5Kv4LPhGo3PdACFJCtsyANtPBXiJbdYvEH+b5q4fX6leqhupMXNzGygkr /tMMeIHAqR7aXinHlZ2T3qanl593ScuUPDqB3/AvErci3s2BGT2Az5fK8wfdQluA2c4Y xV5IziDrphQygZvUGw7Y5Q8xgDC8i03ISUqPw+hXNAqYbhqB97iZ2lfHmfwDwP+WQ1Te hWDoP8e2UJxVJ6/JBVyC12fC9/9aOic0/O24yN7QAz6/CLYQU3y2ZuxIotcYob9+mRws XA3w== X-Gm-Message-State: AOJu0YyiJeD12o2Tb+SJUCZU4q0kqVa0Z+9d33sr7YCX7mCHk388NJ+Y 3bnkSyRFmtClqF6RxTPBwhjVy6DCwlNS8LeGfkYcdjteoIC5GOd8I1h4uwSaMK7ptUcFBwQKDXh jLV4ow2WBuImaP12nlMCNeRmervZXdfo= X-Gm-Gg: ATEYQzyy14OzOXv3qniBcQaIPKE/jkybXgPp+1EYCXVJvYfuS6IhHI0EYpecn+saRSd gr5cHtQ/vb68YwTNunBgehKITDQovz8IhjI0ISlldVIjInThxT/HUqgCv1VDN0Y1eJ4RGaqvT2l 1m/vA9kEgotTsO77pdiHSoEb6SkTrEz+5s56Hx+xAheTV4IG4W7IKdZBIB0VQLEPE1UacDfwUEx GlaJwS7+3Eb3nKjknpf8RCTGC8ySjUnnPgqu68yTuQ0fzr4qzOuZlLbVeX0wKh9VrnVOdbcyyIx EvtqXcmTKDsRAA+EVqNVpYQvslTMGMAQTD+1Tz47goj9nXScAKY56Ad3RdPzFc0gHjcj8HCnQ5P OhorG2zbIhhzzKCaDVqsEdWf3gXQ= X-Received: by 2002:a17:907:e10d:b0:b93:5e04:a722 with SMTP id a640c23a62f3a-b976533bd96mr340254366b.37.1773582308772; Sun, 15 Mar 2026 06:45:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Srinath Reddy Sadipiralla Date: Sun, 15 Mar 2026 19:14:57 +0530 X-Gm-Features: AaiRm50JVg1JnFlm1CONKQb9QMwsCqIOpgp2cvMWxCzpw_lOGwHSCCMo-pPrIdI Message-ID: Subject: Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error To: Mahendra Singh Thalor Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000007e8dca064d104f85" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000007e8dca064d104f85 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Mar 15, 2026 at 9:48=E2=80=AFAM Mahendra Singh Thalor wrote: > On Sun, 13 Apr 2025 at 18:32, Mahendra Singh Thalor > wrote: > > > > Hi, > > With "pg_restore --format=3D", we are not giving any error because in > code, we are checking length of arg but pg_dump is reporting an error for > the same option. > > > > For the consistency purpose, pg_dump and pg_restore both should report > an error for the test case below. > > > > Ex: (output after this patch)but before this patch, below command is > passing. > > /pg_restore x1 -d postgres -j 10 -C --verbose --format=3D > > pg_restore: error: unrecognized archive format ""; please specify "c", > "d", or "t" > > > > Here, I am attaching a patch which is fixing the same. I added 2 TAP > tests also for invalid options. > > > > Note: We have 2 more options in pg_restore code which validate the > option if arg has non zero length. I will prepare patches for both(--host > and --port). We need to add some validate function also for both these > options. > > > > -- > > Thanks and Regards > > Mahendra Singh Thalor > > EnterpriseDB: http://www.enterprisedb.com > > Hi all, > Here I am attaching a re-based patch. > > I think we should sync behaviour with pg_dump and pg_restore. Please > review this patch and let me know feedback. > +1 , patch LGTM, i think this also needs backpatching, but i think in the TAP test, change the test_name from pg_dump to pg_restore. diff --git a/src/bin/pg_dump/t/001_basic.pl b/src/bin/pg_dump/t/001_basic.p= l index bf661910c66..3914fb158c2 100755 --- a/src/bin/pg_dump/t/001_basic.pl +++ b/src/bin/pg_dump/t/001_basic.pl @@ -204,12 +204,12 @@ command_fails_like( command_fails_like( [ 'pg_restore', '-f -', '--format=3D'], qr/\Qpg_restore: error: unrecognized archive format "";\E/, - 'pg_dump: unrecognized archive format empty string'); + 'pg_restore: unrecognized archive format empty string'); command_fails_like( [ 'pg_restore', '-f -', '-F', 'p' ], qr/\Qpg_restore: error: archive format "p" is not supported; please use psql\E/, - 'pg_dump: unrecognized archive format p|plain'); + 'pg_restore: unrecognized archive format p|plain'); command_fails_like( [ 'pg_dump', '--on-conflict-do-nothing' ], --=20 Thanks, Srinath Reddy Sadipiralla EDB: https://www.enterprisedb.com/ --0000000000007e8dca064d104f85 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sun, Mar 15,= 2026 at 9:48=E2=80=AFAM Mahendra Singh Thalor <mahi6run@gmail.com> wrote:
On Sun, 13 Apr 2025 at 18:32, Mahendra Sin= gh Thalor <mahi6= run@gmail.com> wrote:
>
> Hi,
> With "pg_restore --format=3D", we are not giving any error b= ecause in code, we are checking length of arg but pg_dump is reporting an e= rror for the same option.
>
> For the consistency purpose, pg_dump and pg_restore both should report= an error for the test case below.
>
> Ex: (output after this patch)but before this patch, below command is p= assing.
> /pg_restore=C2=A0 x1 -d postgres -j 10 -C --verbose --format=3D
> pg_restore: error: unrecognized archive format ""; please sp= ecify "c", "d", or "t"
>
> Here, I am attaching a patch which is fixing the same. I added 2 TAP t= ests also for invalid options.
>
> Note: We have 2 more options in pg_restore code which validate the opt= ion if arg has non zero length. I will prepare patches for both(--host and = --port). We need to add some validate function also for both these options.=
>
> --
> Thanks and Regards
> Mahendra Singh Thalor
> EnterpriseDB: http://www.enterprisedb.com

Hi all,
Here I am attaching a re-based patch.

I think we should sync behaviour with pg_dump and pg_restore. Please
review this patch and let me know feedback.

+1 , patch LGTM, i think this also needs backpa= tching,
but i think in the TAP test, change the test_name from pg_dump t= o pg_restore.

diff --git a/src/bin/pg_dump/t/001_basic.pl b/src/bin/pg_dump/t/001_basic.pl
index bf661910c66..3914fb158c2 100755
--- a/src/b= in/pg_dump/t/001_basic.pl
+++ b/src/= bin/pg_dump/t/001_basic.pl
@@ -204,1= 2 +204,12 @@ command_fails_like(
=C2=A0command_fails_like(
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 [ 'pg_restore', '-f -', '--format=3D&= #39;],
=C2=A0 =C2=A0 =C2=A0 =C2=A0 qr/\Qpg_restore: error: unrecognized = archive format "";\E/,
- =C2=A0 =C2=A0 =C2=A0 'pg_dump: un= recognized archive format empty string');
+ =C2=A0 =C2=A0 =C2=A0 = 9;pg_restore: unrecognized archive format empty string');
=C2=A0
= =C2=A0command_fails_like(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 [ 'pg_restore&= #39;, '-f -', '-F', 'p' ],
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 qr/\Qpg_restore: error: archive format "p" is not supporte= d; please use psql\E/,
- =C2=A0 =C2=A0 =C2=A0 'pg_dump: unrecognized= archive format p|plain');
+ =C2=A0 =C2=A0 =C2=A0 'pg_restore: u= nrecognized archive format p|plain');
=C2=A0
=C2=A0command_fails_= like(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 [ 'pg_dump', '--on-conflic= t-do-nothing' ],


--
Thanks,
Sri= nath Reddy Sadipiralla
EDB:=C2=A0https://www.enter= prisedb.com/
--0000000000007e8dca064d104f85--