forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3dc37cd
committed
The patch adresses the TODO list item "Allow external interfaces to
extend the GUC variable set".Plugin modules like the pl<lang> modules needs a way to declareconfiguration parameters. The postmaster has no knowledge of suchmodules when it reads the postgresql.conf file. Rather than allowingtotally unknown configuration parameters, the concept of a variable"class" is introduced. Variables that belongs to a declared classes willcreate a placeholder value of string type and will not generate anerror. When a module is loaded, it will declare variables for such aclass and make those variables "consume" any placeholders that has beendefined. Finally, the module will generate warnings for unrecognizedplaceholders defined for its class.More detail:The design is outlined after the suggestions made by Tom Lane and JoeConway in this thread:http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.phpA new string variable 'custom_variable_classes' is introduced. Thisvariable is a comma separated string of identifiers. Each identifierdenots a 'class' that will allow its members to be added without error.This variable must be defined in postmaster.conf.The lexer (guc_file.l) is changed so that it can accept a qualified namein the form <ID>.<ID> as the name of a variable. I also changed so thatthe 'custom_variable_classes', if found, is added first of all variablesin order to remove the order of declaration issue.The guc_variables table is made more dynamic. It is originally createdwith 20% slack and can grow dynamically. A capacity is introduced toavoid resizing every time a new variable is added. guc_variables andnum_guc_variables becomes static (hidden).The GucInfoMain now uses the new function get_guc_variables() andGetNumConfigOptions instead or using the guc_variables directly.The find_option() function, when passed a missing name, will check ifthe name is qualified. If the name is qualified and if the qualifierdenotes a class included in the 'custom_variable_classes', a placeholdervariable will be created. Such a placeholder will not participate in alist operation but will otherwise function as a normal string variable.Define<type>GucVariable() functions will be added, one for each variabletype. They are inteded to be used by add-on modules like the pl<lang>mappings. Example:extern void DefineCustomBoolVariable( const char* name, const char* short_desc, const char* long_desc, bool* valueAddr, GucContext context, GucBoolAssignHook assign_hook, GucShowHook show_hook);(I created typedefs for the assign-hook and show-hook functions). A callto these functions will define a new GUC-variable. If a placeholderexists it will be replaced but it's value will be used in place of thedefault value. The valueAddr is assumed ot point at a default value whenthe define function is called. The only constraint that is imposed on aCustom variable is that its name is qualified.Finally, a function:void EmittWarningsOnPlacholders(const char* className)was added. This function should be called when a module has completedits variable definitions. At that time, no placeholders should remainfor the class that the module uses. If they do, elog(INFO, ...) messageswill be issued to inform the user that unrecognized variables arepresent.Thomas Hallgren1 parentcfbfdc5 commit3dc37cd
File tree
7 files changed
+555
-31
lines changed- doc/src/sgml
- src
- backend
- parser
- utils/misc
- include/utils
7 files changed
+555
-31
lines changedLines changed: 55 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
| 2 | + | |
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| |||
2924 | 2924 |
| |
2925 | 2925 |
| |
2926 | 2926 |
| |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
2927 | 2981 |
| |
2928 | 2982 |
| |
2929 | 2983 |
| |
|
Lines changed: 17 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
14 |
| - | |
| 14 | + | |
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| |||
310 | 310 |
| |
311 | 311 |
| |
312 | 312 |
| |
313 |
| - | |
| 313 | + | |
314 | 314 |
| |
315 | 315 |
| |
316 | 316 |
| |
| |||
859 | 859 |
| |
860 | 860 |
| |
861 | 861 |
| |
862 |
| - | |
| 862 | + | |
863 | 863 |
| |
864 | 864 |
| |
865 | 865 |
| |
866 | 866 |
| |
867 | 867 |
| |
868 | 868 |
| |
869 |
| - | |
| 869 | + | |
870 | 870 |
| |
871 | 871 |
| |
872 | 872 |
| |
| |||
919 | 919 |
| |
920 | 920 |
| |
921 | 921 |
| |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
922 | 935 |
| |
923 | 936 |
| |
924 | 937 |
| |
|
Lines changed: 23 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
7 |
| - | |
| 7 | + | |
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
| 37 | + | |
37 | 38 |
| |
38 | 39 |
| |
39 | 40 |
| |
| |||
65 | 66 |
| |
66 | 67 |
| |
67 | 68 |
| |
| 69 | + | |
68 | 70 |
| |
69 | 71 |
| |
70 | 72 |
| |
| |||
76 | 78 |
| |
77 | 79 |
| |
78 | 80 |
| |
| 81 | + | |
79 | 82 |
| |
80 | 83 |
| |
81 | 84 |
| |
| |||
180 | 183 |
| |
181 | 184 |
| |
182 | 185 |
| |
183 |
| - | |
| 186 | + | |
184 | 187 |
| |
185 | 188 |
| |
186 | 189 |
| |
| |||
217 | 220 |
| |
218 | 221 |
| |
219 | 222 |
| |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
220 | 241 |
| |
221 | 242 |
| |
222 | 243 |
| |
|
0 commit comments
Comments
(0)