|
10 | 10 | * Written by Peter Eisentraut <peter_e@gmx.net>.
|
11 | 11 | *
|
12 | 12 | * IDENTIFICATION
|
13 |
| - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.390 2007/05/04 01:13:44 tgl Exp $ |
| 13 | + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.391 2007/05/08 16:33:51 petere Exp $ |
14 | 14 | *
|
15 | 15 | *--------------------------------------------------------------------
|
16 | 16 | */
|
@@ -2692,18 +2692,6 @@ add_guc_variable(struct config_generic * var, int elevel)
|
2692 | 2692 | return true;
|
2693 | 2693 | }
|
2694 | 2694 |
|
2695 |
| -static int |
2696 |
| -guc_get_index(const char *name) |
2697 |
| -{ |
2698 |
| - int i; |
2699 |
| - |
2700 |
| - for (i = 0; i < num_guc_variables; i++) |
2701 |
| - if (guc_name_compare(name, guc_variables[i]->name) == 0) |
2702 |
| - return i; |
2703 |
| - |
2704 |
| - return -1; |
2705 |
| -} |
2706 |
| - |
2707 | 2695 | /*
|
2708 | 2696 | * Create and add a placeholder variable. It's presumed to belong
|
2709 | 2697 | * to a valid custom variable class at this point.
|
@@ -2843,6 +2831,30 @@ guc_name_compare(const char *namea, const char *nameb)
|
2843 | 2831 | }
|
2844 | 2832 |
|
2845 | 2833 |
|
| 2834 | +static int |
| 2835 | +guc_get_index(const char *name) |
| 2836 | +{ |
| 2837 | + const char **key = &name; |
| 2838 | + struct config_generic **res; |
| 2839 | + |
| 2840 | + Assert(name); |
| 2841 | + |
| 2842 | + /* |
| 2843 | + * By equating const char ** with struct config_generic *, we are assuming |
| 2844 | + * the name field is first in config_generic. |
| 2845 | + */ |
| 2846 | + res = (struct config_generic **) bsearch((void *) &key, |
| 2847 | + (void *) guc_variables, |
| 2848 | + num_guc_variables, |
| 2849 | + sizeof(struct config_generic *), |
| 2850 | + guc_var_compare); |
| 2851 | + if (!res) |
| 2852 | + return -1; |
| 2853 | + |
| 2854 | + return res - guc_variables; |
| 2855 | +} |
| 2856 | + |
| 2857 | + |
2846 | 2858 | /*
|
2847 | 2859 | * Initialize GUC options during program startup.
|
2848 | 2860 | *
|
@@ -4095,9 +4107,10 @@ set_config_option(const char *name, const char *value,
|
4095 | 4107 | * we can't set the variable itself. There's one exception to
|
4096 | 4108 | * this rule: if we want to apply the default value to variables
|
4097 | 4109 | * that were removed from the configuration file. This is
|
4098 |
| - * indicated by source == PGC_S_DEFAULT. |
| 4110 | + * indicated by source == PGC_S_DEFAULT and context == PGC_SIGHUP. |
4099 | 4111 | */
|
4100 |
| - if (record->source > source && source != PGC_S_DEFAULT) |
| 4112 | + if (record->source > source |
| 4113 | + && !(source == PGC_S_DEFAULT && context == PGC_SIGHUP)) |
4101 | 4114 | {
|
4102 | 4115 | if (changeVal && !makeDefault)
|
4103 | 4116 | {
|
|
0 commit comments