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

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: robertmhaas(at)gmail(dot)com
Cc: masao(dot)fujii(at)gmail(dot)com, andres(at)anarazel(dot)de, sawada(dot)mshk(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: VACUUM fails to parse 0 and 1 as boolean value
Date: 2019-05-17 01:21:21
Message-ID: 20190517.102121.72558057.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

We now have several syntax elements seemingly the same but behave
different way.

At Thu, 16 May 2019 15:29:36 -0400, Robert Haas <robertmhaas(at)gmail(dot)com> wrote in <CA+TgmobK1ngid9Pxs7g8RFQDH+O1X4yyL+vMQtaV7i6m-Xn0rw(at)mail(dot)gmail(dot)com>
> On Thu, May 16, 2019 at 2:56 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> > Yes. Thanks for the comment!
> > Attached is the updated version of the patch.
> > It adds such common rule.
>
> I'm not sure how much value it really has to define
> opt_boolean_or_string_or_numeric. It saves 1 line of code in each of
> 3 places, but costs 6 lines of code to have it.

ANALYZE (options) desn't accept 1/0 but only accepts true/false
or on/off. Why are we going to make VACUUM differently?

And the documentation for ANALYZE doesn't mention the change.

I think we don't need to support 1/0 as boolean here (it's
unnatural) and the documentation of VACUUM/ANALYZE should be
fixed.

> Perhaps we could try to unify at a higher level. Like can we merge
> vac_analyze_option_list with explain_option_list?

Also REINDEX (VERBOSE) doesn't accept explict argument as of
now. (reindex_option_list)

I'm not sure about FDW/SERVER/CREATE USER MAPPING but perhaps
it's a different from this.

COPY .. WITH (options) doesn't accpet 1/0 as boolean.

copy_generic_opt_arg:
opt_boolean_or_string { $$ = (Node *) makeString($1); }
| NumericOnly { $$ = (Node *) $1; }
| '*' { $$ = (Node *) makeNode(A_Star); }
| '(' copy_generic_opt_arg_list ')' { $$ = (Node *) $2; }
| /* EMPTY */ { $$ = NULL; }
;

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2019-05-17 01:24:25 Re: VACUUM fails to parse 0 and 1 as boolean value
Previous Message Alexander Korotkov 2019-05-17 00:56:44 Re: Re: SQL/JSON: functions