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

Commit9f5836d

Browse files
committed
Remember the source GucContext for each GUC parameter.
We used to just remember the GucSource, but saving GucContext too providesa little more information --- notably, whether a SET was done by asuperuser or regular user. This allows us to rip out the fairly dodgy codethat define_custom_variable used to use to try to infer the context tore-install a pre-existing setting with. In particular, it now works fora superuser to SET a extension's SUSET custom variable before loading theassociated extension, because GUC can remember whether the SET was done asa superuser or not. The plperl regression tests contain an example wherethis is useful.
1 parent09e196e commit9f5836d

File tree

9 files changed

+73
-81
lines changed

9 files changed

+73
-81
lines changed

‎src/backend/utils/misc/guc-file.l

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,7 @@ ProcessConfigFile(GucContext context)
296296
GUC_ACTION_SET,true);
297297
if (scres >0)
298298
{
299-
/* variable was updated, so remember the source location */
300-
set_config_sourcefile(item->name, item->filename,
301-
item->sourceline);
302-
303-
/* and log the change if appropriate */
299+
/* variable was updated, so log the change if appropriate */
304300
if (pre_value)
305301
{
306302
constchar *post_value =GetConfigOption(item->name,true,false);
@@ -315,7 +311,17 @@ ProcessConfigFile(GucContext context)
315311
}
316312
elseif (scres ==0)
317313
error =true;
318-
/* else no error but variable was not changed, do nothing */
314+
/* else no error but variable's active value was not changed */
315+
316+
/*
317+
* We should update source location unless there was an error, since
318+
* even if the active value didn't change, the reset value might have.
319+
* (In the postmaster, there won't be a difference, but it does matter
320+
* in backends.)
321+
*/
322+
if (scres !=0)
323+
set_config_sourcefile(item->name, item->filename,
324+
item->sourceline);
319325

320326
if (pre_value)
321327
pfree(pre_value);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp