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

Commitddc36df

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 parentf994bf9 commitddc36df

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
@@ -6961,6 +6961,8 @@ is_newvalue_equal(struct config_generic * record, const char *newvalue)
69616961
*
69626962
*variable name, string, null terminated
69636963
*variable value, string, null terminated
6964+
*variable sourcefile, string, null terminated (empty if none)
6965+
*variable sourceline, integer
69646966
*variable source, integer
69656967
*/
69666968
staticvoid
@@ -6997,8 +6999,7 @@ write_one_nondefault_variable(FILE *fp, struct config_generic * gconf)
69976999
{
69987000
structconfig_real*conf= (structconfig_real*)gconf;
69997001

7000-
/* Could lose precision here? */
7001-
fprintf(fp,"%f",*conf->variable);
7002+
fprintf(fp,"%.17g",*conf->variable);
70027003
}
70037004
break;
70047005

@@ -7022,7 +7023,12 @@ write_one_nondefault_variable(FILE *fp, struct config_generic * gconf)
70227023

70237024
fputc(0,fp);
70247025

7025-
fwrite(&gconf->source,sizeof(gconf->source),1,fp);
7026+
if (gconf->sourcefile)
7027+
fprintf(fp,"%s",gconf->sourcefile);
7028+
fputc(0,fp);
7029+
7030+
fwrite(&gconf->sourceline,1,sizeof(gconf->sourceline),fp);
7031+
fwrite(&gconf->source,1,sizeof(gconf->source),fp);
70267032
}
70277033

70287034
void
@@ -7125,8 +7131,10 @@ read_nondefault_variables(void)
71257131
{
71267132
FILE*fp;
71277133
char*varname,
7128-
*varvalue;
7129-
intvarsource;
7134+
*varvalue,
7135+
*varsourcefile;
7136+
intvarsourceline;
7137+
GucSourcevarsource;
71307138

71317139
/*
71327140
* Open file
@@ -7151,16 +7159,26 @@ read_nondefault_variables(void)
71517159
break;
71527160

71537161
if ((record=find_option(varname, true,FATAL))==NULL)
7154-
elog(FATAL,"failed to locate variable %s in exec config params file",varname);
7162+
elog(FATAL,"failed to locate variable \"%s\" in exec config params file",varname);
7163+
71557164
if ((varvalue=read_string_with_null(fp))==NULL)
71567165
elog(FATAL,"invalid format of exec config params file");
7157-
if (fread(&varsource,sizeof(varsource),1,fp)==0)
7166+
if ((varsourcefile=read_string_with_null(fp))==NULL)
71587167
elog(FATAL,"invalid format of exec config params file");
7168+
if (fread(&varsourceline,1,sizeof(varsourceline),fp)!=sizeof(varsourceline))
7169+
elog(FATAL,"invalid format of exec config params file");
7170+
if (fread(&varsource,1,sizeof(varsource),fp)!=sizeof(varsource))
7171+
elog(FATAL,"invalid format of exec config params file");
7172+
7173+
(void)set_config_option(varname,varvalue,
7174+
record->context,varsource,
7175+
GUC_ACTION_SET, true);
7176+
if (varsourcefile[0])
7177+
set_config_sourcefile(varname,varsourcefile,varsourceline);
71597178

7160-
(void)set_config_option(varname,varvalue,record->context,
7161-
varsource,GUC_ACTION_SET, true);
71627179
free(varname);
71637180
free(varvalue);
7181+
free(varsourcefile);
71647182
}
71657183

71667184
FreeFile(fp);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp