10
10
* Written by Peter Eisentraut <[email protected] >.
11
11
*
12
12
* IDENTIFICATION
13
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.478 2008/11/19 01:10:23 tgl Exp $
13
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.479 2008/11/19 02:07:07 tgl Exp $
14
14
*
15
15
*--------------------------------------------------------------------
16
16
*/
@@ -5657,6 +5657,7 @@ define_custom_variable(struct config_generic * variable)
5657
5657
const char * * nameAddr = & name ;
5658
5658
const char * value ;
5659
5659
struct config_string * pHolder ;
5660
+ GucContext phcontext ;
5660
5661
struct config_generic * * res ;
5661
5662
5662
5663
/*
@@ -5702,6 +5703,28 @@ define_custom_variable(struct config_generic * variable)
5702
5703
*/
5703
5704
* res = variable ;
5704
5705
5706
+ /*
5707
+ * Infer context for assignment based on source of existing value.
5708
+ * We can't tell this with exact accuracy, but we can at least do
5709
+ * something reasonable in typical cases.
5710
+ */
5711
+ switch (pHolder -> gen .source )
5712
+ {
5713
+ case PGC_S_DEFAULT :
5714
+ case PGC_S_ENV_VAR :
5715
+ case PGC_S_FILE :
5716
+ case PGC_S_ARGV :
5717
+ phcontext = PGC_SIGHUP ;
5718
+ break ;
5719
+ case PGC_S_DATABASE :
5720
+ case PGC_S_USER :
5721
+ case PGC_S_CLIENT :
5722
+ case PGC_S_SESSION :
5723
+ default :
5724
+ phcontext = PGC_USERSET ;
5725
+ break ;
5726
+ }
5727
+
5705
5728
/*
5706
5729
* Assign the string value stored in the placeholder to the real variable.
5707
5730
*
@@ -5713,7 +5736,7 @@ define_custom_variable(struct config_generic * variable)
5713
5736
5714
5737
if (value )
5715
5738
set_config_option (name , value ,
5716
- pHolder -> gen . context , pHolder -> gen .source ,
5739
+ phcontext , pHolder -> gen .source ,
5717
5740
GUC_ACTION_SET , true);
5718
5741
5719
5742
/*
0 commit comments