Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99576e0

Browse files
committed
Add sourcefile/sourceline data to EXEC_BACKEND GUC transmission files.
This oversight meant that on Windows, the pg_settings view would notdisplay source file or line number information for values coming frompostgresql.conf, unless the backend had received a SIGHUP since starting.In passing, also make the error detection in read_nondefault_variables atad more thorough, and fix it to not lose precision on float GUCs (thesechanges are already in HEAD as of my previous commit).
1 parentb733331 commit99576e0

File tree

1 file changed

+27
-9
lines changed
  • src/backend/utils/misc

1 file changed

+27
-9
lines changed

‎src/backend/utils/misc/guc.c

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7337,6 +7337,8 @@ _ShowOption(struct config_generic * record, bool use_units)
73377337
*
73387338
*variable name, string, null terminated
73397339
*variable value, string, null terminated
7340+
*variable sourcefile, string, null terminated (empty if none)
7341+
*variable sourceline, integer
73407342
*variable source, integer
73417343
*/
73427344
staticvoid
@@ -7373,8 +7375,7 @@ write_one_nondefault_variable(FILE *fp, struct config_generic * gconf)
73737375
{
73747376
structconfig_real*conf= (structconfig_real*)gconf;
73757377

7376-
/* Could lose precision here? */
7377-
fprintf(fp,"%f",*conf->variable);
7378+
fprintf(fp,"%.17g",*conf->variable);
73787379
}
73797380
break;
73807381

@@ -7398,7 +7399,12 @@ write_one_nondefault_variable(FILE *fp, struct config_generic * gconf)
73987399

73997400
fputc(0,fp);
74007401

7401-
fwrite(&gconf->source,sizeof(gconf->source),1,fp);
7402+
if (gconf->sourcefile)
7403+
fprintf(fp,"%s",gconf->sourcefile);
7404+
fputc(0,fp);
7405+
7406+
fwrite(&gconf->sourceline,1,sizeof(gconf->sourceline),fp);
7407+
fwrite(&gconf->source,1,sizeof(gconf->source),fp);
74027408
}
74037409

74047410
void
@@ -7501,8 +7507,10 @@ read_nondefault_variables(void)
75017507
{
75027508
FILE*fp;
75037509
char*varname,
7504-
*varvalue;
7505-
intvarsource;
7510+
*varvalue,
7511+
*varsourcefile;
7512+
intvarsourceline;
7513+
GucSourcevarsource;
75067514

75077515
/*
75087516
* Open file
@@ -7527,16 +7535,26 @@ read_nondefault_variables(void)
75277535
break;
75287536

75297537
if ((record=find_option(varname, true,FATAL))==NULL)
7530-
elog(FATAL,"failed to locate variable %s in exec config params file",varname);
7538+
elog(FATAL,"failed to locate variable \"%s\" in exec config params file",varname);
7539+
75317540
if ((varvalue=read_string_with_null(fp))==NULL)
75327541
elog(FATAL,"invalid format of exec config params file");
7533-
if (fread(&varsource,sizeof(varsource),1,fp)==0)
7542+
if ((varsourcefile=read_string_with_null(fp))==NULL)
75347543
elog(FATAL,"invalid format of exec config params file");
7544+
if (fread(&varsourceline,1,sizeof(varsourceline),fp)!=sizeof(varsourceline))
7545+
elog(FATAL,"invalid format of exec config params file");
7546+
if (fread(&varsource,1,sizeof(varsource),fp)!=sizeof(varsource))
7547+
elog(FATAL,"invalid format of exec config params file");
7548+
7549+
(void)set_config_option(varname,varvalue,
7550+
record->context,varsource,
7551+
GUC_ACTION_SET, true);
7552+
if (varsourcefile[0])
7553+
set_config_sourcefile(varname,varsourcefile,varsourceline);
75357554

7536-
(void)set_config_option(varname,varvalue,record->context,
7537-
varsource,GUC_ACTION_SET, true);
75387555
free(varname);
75397556
free(varvalue);
7557+
free(varsourcefile);
75407558
}
75417559

75427560
FreeFile(fp);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp