On 06/25/2014 03:04 PM, Amit Kapila wrote:
> On Wed, Jun 25, 2014 at 6:20 PM, Christoph Berg <c...@df7cb.de
> <mailto:c...@df7cb.de>> wrote:
>>
>> Hi,
>>
>> is there a reason there's no ALTER SYSTEM RESET?
>>
>> The natural idiom to reset SET statements is "RESET guc;", I don't
>> think "SET guc = default;" is in use much, so "ALTER SYSTEM RESET guc;"
>> would be the natural way to try.
> 
> Currently you can achieve that by
> "ALTER SYSTEM RESET guc = Default;".
> However it will be good to have support for RESET as well.  I think it
> should not be too complicated to implement that syntax, I personally
> don't have bandwidth to it immediately, but I would like to take care
> of it unless you or someone wants to do it by the time I get some
> bandwidth.

Would something like this suffice?
-- 
Vik
*** a/doc/src/sgml/ref/alter_system.sgml
--- b/doc/src/sgml/ref/alter_system.sgml
***************
*** 22,27 **** PostgreSQL documentation
--- 22,28 ----
   <refsynopsisdiv>
  <synopsis>
  ALTER SYSTEM SET <replaceable class="PARAMETER">configuration_parameter</replaceable> { TO | = } { <replaceable class="PARAMETER">value</replaceable> | '<replaceable class="PARAMETER">value</replaceable>' | DEFAULT }
+ ALTER SYSTEM RESET <replaceable class="PARAMETER">configuration_parameter</replaceable>
  </synopsis>
   </refsynopsisdiv>
  
***************
*** 30,37 **** ALTER SYSTEM SET <replaceable class="PARAMETER">configuration_parameter</replace
  
    <para>
     <command>ALTER SYSTEM</command> writes the configuration parameter
!    values to the <filename>postgresql.auto.conf</filename> file. With
!    <literal>DEFAULT</literal>, it removes a configuration entry from
     <filename>postgresql.auto.conf</filename> file. The values will be
     effective after reload of server configuration (SIGHUP) or in next 
     server start based on the type of configuration parameter modified.
--- 31,38 ----
  
    <para>
     <command>ALTER SYSTEM</command> writes the configuration parameter
!    values to the <filename>postgresql.auto.conf</filename> file. Setting the parameter to
!    <literal>DEFAULT</literal>, or using the <command>RESET</command> variant, removes the configuration entry from
     <filename>postgresql.auto.conf</filename> file. The values will be
     effective after reload of server configuration (SIGHUP) or in next 
     server start based on the type of configuration parameter modified.
*** a/src/backend/parser/gram.y
--- b/src/backend/parser/gram.y
***************
*** 8486,8491 **** AlterSystemStmt:
--- 8486,8499 ----
  					n->setstmt = $4;
  					$$ = (Node *)n;
  				}
+ 			| ALTER SYSTEM_P RESET var_name
+ 				{
+ 					AlterSystemStmt *n = makeNode(AlterSystemStmt);
+ 					n->setstmt = makeNode(VariableSetStmt);
+ 					n->setstmt->kind = VAR_RESET;
+ 					n->setstmt->name = $4;
+ 					$$ = (Node *)n;
+ 				}
  		;
  
  
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
***************
*** 6720,6725 **** AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
--- 6720,6726 ----
  			break;
  
  		case VAR_SET_DEFAULT:
+ 		case VAR_RESET:
  			value = NULL;
  			break;
  		default:
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to