Re: [PATCH] vacuumdb: Add --exclude-database option

Japin Li <japinli@hotmail.com>

From: Japin Li <japinli@hotmail.com>
To: Mohamed ALi <moali.pg@gmail.com>
Cc: wenhui qiu <qiuwenhuifx@gmail.com>, Quan Zongliang <quanzongliang@yeah.net>, pgsql-hackers@lists.postgresql.org
Date: 2026-06-10T09:39:16Z
Lists: pgsql-hackers
Hi, Mohamed

On Tue, 09 Jun 2026 at 23:24, Mohamed ALi <moali.pg@gmail.com> wrote:
> Hi Quan, wenhui,
>
> Thanks for the review and feedback.
>
> On Thu, Jun 5, 2026 at 09:25:52 AM, Quan Zongliang wrote:
>> In the vacuum_all_databases function. If the condition 'if
>> (dbsToExclude)' is used. All 'exclude-database' processing (including
>> variable definitions) can be placed in a separate code block.
>
> Good suggestion. Attached is v2 incorporating this change, the
> exclude-database logic (including the `cell` and `first` variable
> declarations) is now scoped inside an `if (dbsToExclude)` block.
> This keeps the variables out of the function's top-level scope when
> the feature isn't being used.
>
>
> The patch is also tracked in CommitFest PG20-1:
> https://commitfest.postgresql.org/patch/6833/

Thanks for updating the patch. I have one question.

+$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.

>
> -- 
> Mohamed Ali
> AWS RDS

-- 
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.