*
* variable name, string, null terminated
* variable value, string, null terminated
+ * variable sourcefile, string, null terminated (empty if none)
+ * variable sourceline, integer
* variable source, integer
* variable scontext, integer
*/
fputc(0, 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);
fwrite(&gconf->scontext, 1, sizeof(gconf->scontext), fp);
}
{
FILE *fp;
char *varname,
- *varvalue;
+ *varvalue,
+ *varsourcefile;
+ int varsourceline;
GucSource varsource;
GucContext varscontext;
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 ((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");
if (fread(&varscontext, 1, sizeof(varscontext), fp) != sizeof(varscontext))
(void) set_config_option(varname, varvalue,
varscontext, varsource,
GUC_ACTION_SET, true);
+ if (varsourcefile[0])
+ set_config_sourcefile(varname, varsourcefile, varsourceline);
+
free(varname);
free(varvalue);
+ free(varsourcefile);
}
FreeFile(fp);