Re: Proposal for Allow postgresql.conf values to be changed via SQL

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal for Allow postgresql.conf values to be changed via SQL
Date: 2012-12-03 15:21:12
Message-ID: CA+Tgmoa=U-PkTEYDbKaxcFig_2xwz58gs=oQ-2VcamEmGV3a2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 3, 2012 at 6:38 AM, Amit Kapila <amit(dot)kapila(at)huawei(dot)com> wrote:
> On Saturday, December 01, 2012 10:00 PM Tom Lane wrote:
>> Amit Kapila <amit(dot)kapila(at)huawei(dot)com> writes:
>> > On Saturday, December 01, 2012 1:30 AM Tom Lane wrote:
>> which cannot work if "persistent" could be a var_name, because bison
>> has to decide whether to reduce opt_persistent to PERSISTENT or empty
>> before it can see if there's anything after the var_name. So the fix
>> is to not use an opt_persistent production, but spell out both
>> alternatives:
>>
>> RESET var_name
>>
>> RESET PERSISTENT var_name
>>
>> Now bison doesn't have to choose what to reduce until it can see the end
>> of the statement; that is, once it's scanned RESET and PERSISTENT, the
>> choice of whether to treat PERSISTENT as a var_name can be conditional
>> on whether the next token is a name or EOL.
>
> With the above suggestion also, it's not able to resolve shift/reduce
> errors.
>
> However I have tried with below changes in gram.y, it works after below
> change.
>
> %left PERSISTENT
>
> VariableResetStmt:
> RESET opt_persistent reset_common
> {
> VariableSetStmt *n = $3;
> n->is_persistent = $2;
> $$ = (Node *) n;
> }
> ;
>
> opt_persistent: PERSISTENT { $$ = TRUE; }
> | /*EMPTY*/ %prec Op { $$ = FALSE; }
> ;
>
> I am not sure if there are any problems with above change.

We usually try to avoid operator precedence declarations. They
sometimes have unforeseen consequences.

> Found one difference with the change is, the command "reset persistent"
> execution results in different errors with/without change.
>
> without change:
> unrecognized configuration parameter "persistent".
> with change:
> syntax error at or near ";"

...but this in itself doesn't seem like a problem.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2012-12-03 15:25:21 Re: [v9.3] Row-Level Security
Previous Message Robert Haas 2012-12-03 15:19:41 Re: Proposal for Allow postgresql.conf values to be changed via SQL