Re: Restore check_mut_excl_opts, usage in pg_restore and pg_dumpall - Mailing list pgsql-hackers

From Mahendra Singh Thalor
Subject Re: Restore check_mut_excl_opts, usage in pg_restore and pg_dumpall
Date
Msg-id CAKYtNArryDL=KZ=FCcdsk3GsS4JaoUjgSG209qm+1hWMke+21Q@mail.gmail.com
Whole thread
In response to Re: Restore check_mut_excl_opts, usage in pg_restore and pg_dumpall  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
Thanks Fujii Masao for the review and feedback.

On Fri, 17 Jul 2026 at 16:43, Fujii Masao <masao.fujii@gmail.com> wrote:
>
> On Tue, Jul 14, 2026 at 5:31 PM Mahendra Singh Thalor
> <mahi6run@gmail.com> wrote:
> > Attached are two small, independent patches that redo that conversion on
> > top of current master:
>
> Thanks for the patches!
>
>
> >   0001 - pg_restore.c: converts its *-only / --no-* / --statistics /
> >          --clean / --single-transaction conflict checks to
> >          check_mut_excl_opts().
>
> Commit 7c8280eeb58 converted the checks for -d/--dbname vs. -f/--file and
> -d/--dbname vs. --restrict-key to use check_mut_excl_opts(). But this patch
> doesn't seem to restore those conversions. Is that intentional?

I missed this. Fixed.

>
>
> >   0002 - pg_dumpall.c: same conversion for --exclude-database, the *-only
> >          options, their --no-* counterparts, --statistics, and --clean.
> >          Also tracks -s/--schema-only locally (schema_only), which
> >          pg_dumpall previously just passed through to pg_dump without
> >          recording, since check_mut_excl_opts() needs it. Updates the
> >          expected error text in the TAP tests to match
> >          check_mut_excl_opts()'s "options X and Y cannot be used together"
> >          wording, and adds coverage for a couple of option pairs that
> >          previously had no dedicated test.
>
> + /* --exclude-database is incompatible with global *-only options */
> + check_mut_excl_opts(database_exclude_patterns.head, "--exclude-database",
> + globals_only, "-g/--globals-only",

Agreed. Fixed.

>
> database_exclude_patterns.head is a pointer, but check_mut_excl_opts_internal()
> reads the corresponding varargs value as an int. Passing a pointer and reading
> it as an int doesn't seem correct. How about passing a boolean instead, e.g.:
>
>     check_mut_excl_opts(database_exclude_patterns.head != NULL,
>
> There seems to be a similar existing call in pg_dump.c using
> foreign_servers_include_patterns.head, so it would be good to fix
> that as well.

Fixed.

> Regards,
>
> --
> Fujii Masao

Here, I am attaching 3 patches for the review.

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

Attachment

pgsql-hackers by date:

Previous
From: Rafia Sabih
Date:
Subject: Re: postgres_fdw: Emit message when batch_size is reduced
Next
From: Amit Kapila
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication