| From: | Mohamed ALi <moali(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Japin Li <japinli(at)hotmail(dot)com> |
| Cc: | wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, Quan Zongliang <quanzongliang(at)yeah(dot)net>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: [PATCH] vacuumdb: Add --exclude-database option |
| Date: | 2026-06-11 07:35:14 |
| Message-ID: | CAGnOmWqe0uqVPn7Vq38jsa9v_QbbdRJFYsi3h=cSkgxzZA5Kvw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-vacuumdb-Add-exclude-database-option-to-skip-data.patch | application/octet-stream | 10.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Smith | 2026-06-11 07:37:52 | Re: Add pg_get_publication_ddl function |
| Previous Message | Masahiko Sawada | 2026-06-11 07:07:26 | Re: Support logical replication of DDLs, take2 |