Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error - Mailing list pgsql-hackers

From Mahendra Singh Thalor
Subject Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error
Date
Msg-id CAKYtNApxyeeQbjxjFCgHwuv0T2TJvFaU6QSQaMU_yr1nP4Y8Fg@mail.gmail.com
Whole thread
In response to pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error  (Mahendra Singh Thalor <mahi6run@gmail.com>)
Responses Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error
Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error
List pgsql-hackers
On Sun, 13 Apr 2025 at 18:32, Mahendra Singh Thalor <mahi6run@gmail.com> wrote:
>
> Hi,
> With "pg_restore --format=", we are not giving any error because in code, we are checking length of arg but pg_dump
isreporting 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=
> 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
patchesfor 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.

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

Attachment

pgsql-hackers by date:

Previous
From: Mahendra Singh Thalor
Date:
Subject: pg_restore: remove unnecessary code from restore_all_databases function
Next
From: Marcos Magueta
Date:
Subject: Re: WIP - xmlvalidate implementation from TODO list