Hi Japin, Thanks for the review.
On Tue, Jun 10, 2026 at 09:39:16 AM, Japin Li wrote:
> +$node->command_fails_like(
> + [ 'vacuumdb', '-d' => 'postgres', '--exclude-database' =>
> 'regression_excl_test' ],
> + qr/cannot use --exclude-database without --all option/,
> + 'cannot use --exclude-database with -d');
>
> The test is a bit confusing to me. It does not state that
> --exclude-database cannot be used with the -d option.
Good catch. The issue was that "vacuumdb -d postgres -D test_db1"
produced "cannot use --exclude-database without --all option", which
is misleading — if the user then adds --all, they hit a second error
("cannot vacuum all databases and a specific one at the same time").
Before (v2):
$ vacuumdb -D test_db1
vacuumdb: error: cannot use --exclude-database without --all option
$ vacuumdb -d postgres -D test_db1
vacuumdb: error: cannot use --exclude-database without --all option
$ vacuumdb -d postgres -D test_db1 --all
vacuumdb: error: cannot vacuum all databases and a specific one at
the same time
After (v3):
$ vacuumdb -D test_db1
vacuumdb: error: cannot use the "exclude-database" option without
the "all" option
$ vacuumdb -d postgres -D test_db1
vacuumdb: error: cannot use the "exclude-database" option with the
"dbname" option
$ vacuumdb -d postgres -D test_db1 --all
vacuumdb: error: cannot vacuum all databases and a specific one at
the same time
v3 adds a separate check that fires first when both -d and
--exclude-database are used together, giving a clear error instead
of bouncing the user between two messages.
Changes in v3:
- Added a check for OBJFILTER_DATABASE_EXCLUDE + OBJFILTER_DATABASE
that fires before the "without all" check, giving a clear error
when both options are specified together.
- Both error messages now use the pg_fatal("%s") format consistent
with other option-conflict errors in vacuumdb.c.
- Updated TAP test to match the new error messages.
--
Mohamed Ali
AWS RDS
v3-0001-vacuumdb-Add-exclude-database-option-to-skip-data.patch
Description: Binary data
