| From: | Mahendra Singh Thalor <mahi6run(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, nathan(at)postgresql(dot)org |
| Subject: | Restore check_mut_excl_opts, usage in pg_restore and pg_dumpall |
| Date: | 2026-07-14 08:30:54 |
| Message-ID: | CAKYtNAo-xsBzDQm6bUO_RPPmRkBKFUgnkU0HPhGaeGJHMBx1dA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
Commit 7ca548f23a6 reverted pg_dumpall's non-text output format support
per Noah Misch's post-commit review. That revert was scoped carefully to
remove only the feature itself, but its commit message notes one piece of
unavoidable collateral damage:
Because the feature restructured pg_dumpall.c and pg_restore.c (pg_restore's
main() was split into restore_one_database() plus a dispatcher) and
interleaved its option checks with the conflicting-option refactor in the
same regions, the cosmetic check_mut_excl_opts() reflow of those two files'
option blocks is inseparable from the feature and comes out with it; the
behavior is unchanged.
In other words, pg_restore.c and pg_dumpall.c both went back to their old,
ad hoc pairwise "if (a && b) pg_fatal(...)" style option-conflict checks,
even though converting them to use the shared check_mut_excl_opts() helper
(added by b2898baaf7e, and already used by pg_dump.c) is a purely mechanical,
behavior-preserving cleanup with no dependency on the reverted feature's
design.
Attached are two small, independent patches that redo that conversion on
top of current master:
0001 - pg_restore.c: converts its *-only / --no-* / --statistics /
--clean / --single-transaction conflict checks to
check_mut_excl_opts().
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.
Both patches preserve the exact pre-existing error-message wording and
option-reporting order for every combination that already had test
coverage; I verified this with the full src/bin/pg_dump TAP suite
(make check), which passes cleanly with both patches applied.
They're independent of each other and can be applied/reviewed in either
order or separately.
I think we can commit those into v19 and master. Please review and let
me know feedback.
--
Thanks and Regards
Mahendra Singh Thalor
EnterpriseDB: http://www.enterprisedb.com
| Attachment | Content-Type | Size |
|---|---|---|
| v01-0001-pg_restore-Use-check_mut_excl_opts-for-mutually-exc.patch | text/x-patch | 4.4 KB |
| v01-0002-pg_dumpall-Use-check_mut_excl_opts-for-mutually-exc.patch | text/x-patch | 8.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2026-07-14 08:35:37 | Re: Grab bag of smaller OpenSSL fixups |
| Previous Message | Michael Paquier | 2026-07-14 08:07:19 | Re: [Proposal] Adding callback support for custom statistics kinds |