diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-10-04 16:13:16 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-10-04 16:13:50 -0400 |
commit | 9f5836d224e876399dfdd7d6d4343300dbc2f664 (patch) | |
tree | a0dd0059e615f56af1bdc969399aff085160732c /src/include/utils/guc_tables.h | |
parent | 09e196e4539a70c51e828abcfe48dee3efd312d8 (diff) |
Remember the source GucContext for each GUC parameter.
We used to just remember the GucSource, but saving GucContext too provides
a little more information --- notably, whether a SET was done by a
superuser or regular user. This allows us to rip out the fairly dodgy code
that define_custom_variable used to use to try to infer the context to
re-install a pre-existing setting with. In particular, it now works for
a superuser to SET a extension's SUSET custom variable before loading the
associated extension, because GUC can remember whether the SET was done as
a superuser or not. The plperl regression tests contain an example where
this is useful.
Diffstat (limited to 'src/include/utils/guc_tables.h')
-rw-r--r-- | src/include/utils/guc_tables.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h index 84e9fb54d2f..21342f59acd 100644 --- a/src/include/utils/guc_tables.h +++ b/src/include/utils/guc_tables.h @@ -118,9 +118,11 @@ typedef struct guc_stack int nest_level; /* nesting depth at which we made entry */ GucStackState state; /* see enum above */ GucSource source; /* source of the prior value */ + /* masked value's source must be PGC_S_SESSION, so no need to store it */ + GucContext scontext; /* context that set the prior value */ + GucContext masked_scontext; /* context that set the masked value */ config_var_value prior; /* previous value of variable */ config_var_value masked; /* SET value in a GUC_SET_LOCAL entry */ - /* masked value's source must be PGC_S_SESSION, so no need to store it */ } GucStack; /* @@ -143,21 +145,21 @@ struct config_generic enum config_group group; /* to help organize variables by function */ const char *short_desc; /* short desc. of this variable's purpose */ const char *long_desc; /* long desc. of this variable's purpose */ - int flags; /* flag bits, see below */ + int flags; /* flag bits, see guc.h */ /* variable fields, initialized at runtime: */ enum config_type vartype; /* type of variable (set only at startup) */ int status; /* status bits, see below */ - GucSource reset_source; /* source of the reset_value */ GucSource source; /* source of the current actual value */ + GucSource reset_source; /* source of the reset_value */ + GucContext scontext; /* context that set the current value */ + GucContext reset_scontext; /* context that set the reset value */ GucStack *stack; /* stacked prior values */ void *extra; /* "extra" pointer for current actual value */ char *sourcefile; /* file current setting is from (NULL if not - * file) */ + * set in config file) */ int sourceline; /* line in source file */ }; -/* bit values in flags field are defined in guc.h */ - /* bit values in status field */ #define GUC_IS_IN_FILE 0x0001 /* found it in config file */ /* |