Re: Restore check_mut_excl_opts, usage in pg_restore and pg_dumpall

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, nathan(at)postgresql(dot)org
Subject: Re: Restore check_mut_excl_opts, usage in pg_restore and pg_dumpall
Date: 2026-07-17 11:13:31
Message-ID: CAHGQGwEHTBuh8HN5Vz-5xr+h8eL-rtPzgvjSX6z-g=UGTj1YBA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 14, 2026 at 5:31 PM Mahendra Singh Thalor
<mahi6run(at)gmail(dot)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?

> 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",

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.

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-07-17 11:20:05 Re: Restrict data checksums entries in pg_stat_io
Previous Message solai v 2026-07-17 11:10:29 Re: Rename EXISTS-to-ANY converted subplan to exists_to_any