summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/misc/guc.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 6507ad62bf2..5cc90fbe51f 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -7337,6 +7337,8 @@ _ShowOption(struct config_generic * record, bool use_units)
*
* variable name, string, null terminated
* variable value, string, null terminated
+ * variable sourcefile, string, null terminated (empty if none)
+ * variable sourceline, integer
* variable source, integer
*/
static void
@@ -7373,8 +7375,7 @@ write_one_nondefault_variable(FILE *fp, struct config_generic * gconf)
{
struct config_real *conf = (struct config_real *) gconf;
- /* Could lose precision here? */
- fprintf(fp, "%f", *conf->variable);
+ fprintf(fp, "%.17g", *conf->variable);
}
break;
@@ -7398,7 +7399,12 @@ write_one_nondefault_variable(FILE *fp, struct config_generic * gconf)
fputc(0, fp);
- fwrite(&gconf->source, sizeof(gconf->source), 1, fp);
+ if (gconf->sourcefile)
+ fprintf(fp, "%s", gconf->sourcefile);
+ fputc(0, fp);
+
+ fwrite(&gconf->sourceline, 1, sizeof(gconf->sourceline), fp);
+ fwrite(&gconf->source, 1, sizeof(gconf->source), fp);
}
void
@@ -7501,8 +7507,10 @@ read_nondefault_variables(void)
{
FILE *fp;
char *varname,
- *varvalue;
- int varsource;
+ *varvalue,
+ *varsourcefile;
+ int varsourceline;
+ GucSource varsource;
/*
* Open file
@@ -7527,16 +7535,26 @@ read_nondefault_variables(void)
break;
if ((record = find_option(varname, true, FATAL)) == NULL)
- elog(FATAL, "failed to locate variable %s in exec config params file", varname);
+ elog(FATAL, "failed to locate variable \"%s\" in exec config params file", varname);
+
if ((varvalue = read_string_with_null(fp)) == NULL)
elog(FATAL, "invalid format of exec config params file");
- if (fread(&varsource, sizeof(varsource), 1, fp) == 0)
+ if ((varsourcefile = read_string_with_null(fp)) == NULL)
elog(FATAL, "invalid format of exec config params file");
+ if (fread(&varsourceline, 1, sizeof(varsourceline), fp) != sizeof(varsourceline))
+ elog(FATAL, "invalid format of exec config params file");
+ if (fread(&varsource, 1, sizeof(varsource), fp) != sizeof(varsource))
+ elog(FATAL, "invalid format of exec config params file");
+
+ (void) set_config_option(varname, varvalue,
+ record->context, varsource,
+ GUC_ACTION_SET, true);
+ if (varsourcefile[0])
+ set_config_sourcefile(varname, varsourcefile, varsourceline);
- (void) set_config_option(varname, varvalue, record->context,
- varsource, GUC_ACTION_SET, true);
free(varname);
free(varvalue);
+ free(varsourcefile);
}
FreeFile(fp);