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

Commit009f8d1

Browse files
committed
Extend check_GUC_init() with checks on flag combinations when loading GUCs
This extends the work begun bya73952b, with the addition of a GUC checkfor flag combinations in check_GUC_init(), making sure that anythingdefined with GUC_NO_SHOW_ALL also includes GUC_NOT_IN_SAMPLE, as firststep. There has never been any GUCs of this kind in the core code, andthis combination makes little sense as a parameter marked as not fit forSHOW ALL should not be hidden in postgresql.conf.sample.Note that GUCs marked with GUC_NO_SHOW_ALL are not listed underpg_settings or SHOW ALL (still they can be queried individually), makingthem unfit for checks via SQL queries in the regression tests that do afull scan of the parameters available. The SQL tests are still a bitincorrect about that, and will be cleaned up in a separate commit. Wehave also discussed the possibility to extend the SQL functions for GUCsso as they could show more information about parameters defined withGUC_NO_SHOW_ALL, though it has been concluded that this is not worth theextra complication in the long run, an enforced policy at initializationtime being enough to do the same job.Per discussion with Nitin Jadhav and Tom Lane.Discussion:https://postgr.es/m/CAMm1aWaYe0muu3ABo7iSAgK+OWDS9yNe8GGRYnCyeEpScYKa+g@mail.gmail.com
1 parentd07c294 commit009f8d1

File tree

1 file changed

+22
-4
lines changed
  • src/backend/utils/misc

1 file changed

+22
-4
lines changed

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,11 +1383,14 @@ check_GUC_name_for_parameter_acl(const char *name)
13831383
}
13841384

13851385
/*
1386-
* Routine in charge of checking that the initial value of a GUC is the
1387-
* same when declared and when loaded to prevent anybody looking at the
1388-
* C declarations of these GUCS from being fooled by mismatched values.
1386+
* Routine in charge of checking various states of a GUC.
13891387
*
1390-
* The following validation rules apply:
1388+
* This performs two sanity checks. First, it checks that the initial
1389+
* value of a GUC is the same when declared and when loaded to prevent
1390+
* anybody looking at the C declarations of these GUCS from being fooled by
1391+
* mismatched values. Second, it checks for incorrect flag combinations.
1392+
*
1393+
* The following validation rules apply for the values:
13911394
* bool - can be false, otherwise must be same as the boot_val
13921395
* int - can be 0, otherwise must be same as the boot_val
13931396
* real - can be 0.0, otherwise must be same as the boot_val
@@ -1398,6 +1401,7 @@ check_GUC_name_for_parameter_acl(const char *name)
13981401
staticbool
13991402
check_GUC_init(structconfig_generic*gconf)
14001403
{
1404+
/* Checks on values */
14011405
switch (gconf->vartype)
14021406
{
14031407
casePGC_BOOL:
@@ -1462,6 +1466,20 @@ check_GUC_init(struct config_generic *gconf)
14621466
}
14631467
}
14641468

1469+
/* Flag combinations */
1470+
1471+
/*
1472+
* GUC_NO_SHOW_ALL requires GUC_NOT_IN_SAMPLE, as a parameter not part
1473+
* of SHOW ALL should not be hidden in postgresql.conf.sample.
1474+
*/
1475+
if ((gconf->flags&GUC_NO_SHOW_ALL)&&
1476+
!(gconf->flags&GUC_NOT_IN_SAMPLE))
1477+
{
1478+
elog(LOG,"GUC %s flags: NO_SHOW_ALL and !NOT_IN_SAMPLE",
1479+
gconf->name);
1480+
return false;
1481+
}
1482+
14651483
return true;
14661484
}
14671485
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp