Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 40fda15

Browse files
committed
Code review for GUC revert-values-if-removed-from-postgresql.conf patch;
and in passing, fix some bogosities dating from the custom_variable_classes patch. Fix guc-file.l to correctly check changes in custom_variable_classes that are attempted concurrently with additions/removals of custom variables, and don't allow the new setting to be applied in advance of checking it. Clean up messy and undocumented situation for string variables with NULL boot_val. Fix DefineCustomVariable functions to initialize boot_val correctly. Prevent find_option from inserting bogus placeholders for custom variables that are simply inquired about rather than being set.
1 parent 43df609 commit 40fda15

File tree

5 files changed

+407
-392
lines changed

5 files changed

+407
-392
lines changed

src/backend/utils/cache/ts_cache.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Copyright (c) 2006-2007, PostgreSQL Global Development Group
2121
*
2222
* IDENTIFICATION
23-
* $PostgreSQL: pgsql/src/backend/utils/cache/ts_cache.c,v 1.2 2007/08/22 01:39:45 tgl Exp $
23+
* $PostgreSQL: pgsql/src/backend/utils/cache/ts_cache.c,v 1.3 2007/09/10 00:57:21 tgl Exp $
2424
*
2525
*-------------------------------------------------------------------------
2626
*/
@@ -592,14 +592,6 @@ getTSCurrentConfig(bool emitError)
592592
const char *
593593
assignTSCurrentConfig(const char *newval, bool doit, GucSource source)
594594
{
595-
/* do nothing during initial GUC setup */
596-
if (newval == NULL)
597-
{
598-
if (doit)
599-
TSCurrentConfigCache = InvalidOid;
600-
return newval;
601-
}
602-
603595
/*
604596
* If we aren't inside a transaction, we cannot do database access so
605597
* cannot verify the config name. Must accept it on faith.
@@ -637,7 +629,7 @@ assignTSCurrentConfig(const char *newval, bool doit, GucSource source)
637629
newval = strdup(buf);
638630
pfree(buf);
639631

640-
if (doit)
632+
if (doit && newval)
641633
TSCurrentConfigCache = cfgId;
642634
}
643635
else

src/backend/utils/misc/README

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$PostgreSQL: pgsql/src/backend/utils/misc/README,v 1.5 2004/07/01 00:51:24 tgl Exp $
1+
$PostgreSQL: pgsql/src/backend/utils/misc/README,v 1.6 2007/09/10 00:57:21 tgl Exp $
22

33

44
GUC IMPLEMENTATION NOTES
@@ -53,6 +53,14 @@ The third choice is allowed in case the assign_hook wants to return a
5353
datestyle always returns a string that includes both output and input
5454
datestyle options, although the input might have specified only one.
5555

56+
Note that a string variable's assign_hook will NEVER be called with a NULL
57+
value for newvalue, since there would be no way to distinguish success
58+
and failure returns. If the boot_val or reset_val for a string variable
59+
is NULL, it will just be assigned without calling the assign_hook.
60+
Therefore, a NULL boot_val should never be used in combination with an
61+
assign_hook that has side-effects, as the side-effects wouldn't happen
62+
during a RESET that re-institutes the boot-time setting.
63+
5664
If a show_hook is provided, it points to a function of the signature
5765
const char *show_hook(void)
5866
This hook allows variable-specific computation of the value displayed

0 commit comments

Comments
 (0)