Re: Bug fix in vacuumdb --buffer-usage-limit xxx -Z

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Ryoga Yoshida <bt23yoshidar(at)oss(dot)nttdata(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Bug fix in vacuumdb --buffer-usage-limit xxx -Z
Date: 2023-09-21 04:18:55
Message-ID: CAApHDvqRHeik_F8egXCQZXXnRgjj-Wg2rLsds1Kx-efv_1bYnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 21 Sept 2023 at 13:45, Ryoga Yoshida
<bt23yoshidar(at)oss(dot)nttdata(dot)com> wrote:
> When --buffer-usage-limit option is specified, vacuumdb issues VACUUM or
> VACUUM ANALYZE command with BUFFER_USAGE_LIMIT option. Also if
> --buffer-usage-limit and -Z options are specified, vacuumdb should issue
> ANALYZE command with BUFFER_USAGE_LIMIT option. But it does not. That
> is, vacuumdb -Z seems to fail to handle --buffer-usage-limit option.
> This seems a bug.
>
> You can see my patch in the attached file and how it works by adding -e
> option in vacuumdb.

Thanks for the report and the patch. I agree this has been overlooked.

I also wonder if we should be escaping the buffer-usage-limit string
sent in the comment. It seems quite an unlikely attack vector, as the
user would have command line access and could likely just use psql
anyway, but I had thought about something along the lines of:

$ vacuumdb --buffer-usage-limit "1MB'); drop database postgres;--" postgres
vacuumdb: vacuuming database "postgres"
vacuumdb: error: processing of database "postgres" failed: ERROR:
VACUUM cannot run inside a transaction block

seems that won't work, due to sending multiple commands at once, but I
think we should fix it anyway.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2023-09-21 04:20:19 Re: Memory consumed by child SpecialJoinInfo in partitionwise join planning
Previous Message shveta malik 2023-09-21 03:46:29 Re: Synchronizing slots from primary to standby