pgsql: Cleanup VACUUM option processing error messages

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Cleanup VACUUM option processing error messages
Date: 2025-10-09 20:25:52
Message-ID: E1v6xCy-000tIj-0v@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Cleanup VACUUM option processing error messages

The processing of the PARALLEL option for VACUUM was not quite
following what the DefElem code had intended. defGetInt32() already has
code to handle missing parameters and returns a perfectly good error
message for when that happens.

Here we get rid of the ExecVacuum() error:

ERROR: parallel option requires a value between 0 and N

and leave defGetInt32() handle it, which will give:

ERROR: parallel requires an integer value

defGetInt32() was already handling the non-integer parameter case, so it
may as well handle the missing parameter case too.

Additionally, parameterize the option name to make translator work easier,
and also use errhint_internal() rather than errhint() for the
BUFFER_USAGE_LIMIT option since there isn't any work for a translator to
do for "%s".

Author: David Rowley <dgrowleyml(at)gmail(dot)com>
Reviewed-by: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAApHDvovH14tNWB+WvP6TSbfi7-=TysQ9h5tQ5AgavwyWRWKHA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1b073cba4993b31fbf820504f297efce5d951c00

Modified Files
--------------
src/backend/commands/vacuum.c | 42 ++++++++++++++----------------------
src/test/regress/expected/vacuum.out | 6 ++----
2 files changed, 18 insertions(+), 30 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Melanie Plageman 2025-10-09 20:30:45 pgsql: Eliminate COPY FREEZE use of XLOG_HEAP2_VISIBLE
Previous Message Tom Lane 2025-10-09 19:37:49 pgsql: Clean up memory leakage that occurs in context callback function