@@ -425,6 +425,7 @@ booldefault_with_oids = false;
425
425
bool SQL_inheritance = true;
426
426
427
427
bool Password_encryption = true;
428
+ bool session_auth_is_superuser ;
428
429
429
430
int log_min_error_statement = ERROR ;
430
431
int log_min_messages = WARNING ;
@@ -471,7 +472,6 @@ inthuge_pages;
471
472
* and is kept in sync by assign_hooks.
472
473
*/
473
474
static char * syslog_ident_str ;
474
- static bool session_auth_is_superuser ;
475
475
static double phony_random_seed ;
476
476
static char * client_encoding_string ;
477
477
static char * datestyle_string ;
@@ -8884,12 +8884,18 @@ read_nondefault_variables(void)
8884
8884
* constants; a few, like server_encoding and lc_ctype, are handled specially
8885
8885
* outside the serialize/restore procedure. Therefore, SerializeGUCState()
8886
8886
* never sends these, and RestoreGUCState() never changes them.
8887
+ *
8888
+ * Role is a special variable in the sense that its current value can be an
8889
+ * invalid value and there are multiple ways by which that can happen (like
8890
+ * after setting the role, someone drops it). So we handle it outside of
8891
+ * serialize/restore machinery.
8887
8892
*/
8888
8893
static bool
8889
8894
can_skip_gucvar (struct config_generic * gconf )
8890
8895
{
8891
8896
return gconf -> context == PGC_POSTMASTER ||
8892
- gconf -> context == PGC_INTERNAL || gconf -> source == PGC_S_DEFAULT ;
8897
+ gconf -> context == PGC_INTERNAL || gconf -> source == PGC_S_DEFAULT ||
8898
+ strcmp (gconf -> name ,"role" )== 0 ;
8893
8899
}
8894
8900
8895
8901
/*
@@ -9150,27 +9156,14 @@ SerializeGUCState(Size maxsize, char *start_address)
9150
9156
Size actual_size ;
9151
9157
Size bytes_left ;
9152
9158
int i ;
9153
- int i_role = -1 ;
9154
9159
9155
9160
/* Reserve space for saving the actual size of the guc state */
9156
9161
Assert (maxsize > sizeof (actual_size ));
9157
9162
curptr = start_address + sizeof (actual_size );
9158
9163
bytes_left = maxsize - sizeof (actual_size );
9159
9164
9160
9165
for (i = 0 ;i < num_guc_variables ;i ++ )
9161
- {
9162
- /*
9163
- * It's pretty ugly, but we've got to force "role" to be initialized
9164
- * after "session_authorization"; otherwise, the latter will override
9165
- * the former.
9166
- */
9167
- if (strcmp (guc_variables [i ]-> name ,"role" )== 0 )
9168
- i_role = i ;
9169
- else
9170
- serialize_variable (& curptr ,& bytes_left ,guc_variables [i ]);
9171
- }
9172
- if (i_role >=0 )
9173
- serialize_variable (& curptr ,& bytes_left ,guc_variables [i_role ]);
9166
+ serialize_variable (& curptr ,& bytes_left ,guc_variables [i ]);
9174
9167
9175
9168
/* Store actual size without assuming alignment of start_address. */
9176
9169
actual_size = maxsize - bytes_left - sizeof (actual_size );