Re: VACUUM fails to parse 0 and 1 as boolean value

From: Andres Freund <andres(at)anarazel(dot)de>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VACUUM fails to parse 0 and 1 as boolean value
Date: 2019-05-14 17:52:23
Message-ID: 20190514175223.hkr7ojp5pro2pzwm@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2019-05-15 02:45:21 +0900, Fujii Masao wrote:
> VACUUM fails to parse 0 and 1 as boolean value
>
> The document for VACUUM explains
>
> boolean
> Specifies whether the selected option should be turned on or off.
> You can write TRUE, ON, or 1 to enable the option, and FALSE, OFF,
> or 0 to disable it.
>
> But VACUUM fails to parse 0 and 1 as boolean value as follows.
>
> =# VACUUM (INDEX_CLEANUP 1);
> ERROR: syntax error at or near "1" at character 23
> STATEMENT: VACUUM (INDEX_CLEANUP 1);
>
> This looks a bug. The cause of this is a lack of NumericOnly clause
> for vac_analyze_option_arg in gram.y. The attached patch
> adds such NumericOnly. The bug exists only in 12dev.
>
> Barring any objection, I will commit the patch.

Might be worth having a common rule for such options, so we don't
duplicate the knowledge between different places.

CCing Robert and Sawada-san, who committed / authored that code.

commit 41b54ba78e8c4d64679ba4daf82e4e2efefe1922
Author: Robert Haas <rhaas(at)postgresql(dot)org>
Date: 2019-03-29 08:22:49 -0400

Allow existing VACUUM options to take a Boolean argument.

This makes VACUUM work more like EXPLAIN already does without changing
the meaning of any commands that already work. It is intended to
facilitate the addition of future VACUUM options that may take
non-Boolean parameters or that default to false.

Masahiko Sawada, reviewed by me.

Discussion: http://postgr.es/m/CA+TgmobpYrXr5sUaEe_T0boabV0DSm=utSOZzwCUNqfLEEm8Mw@mail.gmail.com
Discussion: http://postgr.es/m/CAD21AoBaFcKBAeL5_++j+Vzir2vBBcF4juW7qH8b3HsQY=Q6+w@mail.gmail.com

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2019-05-14 17:55:27 Re: vacuumdb and new VACUUM options
Previous Message Fujii Masao 2019-05-14 17:45:21 VACUUM fails to parse 0 and 1 as boolean value