]> granicus.if.org Git - postgresql/commitdiff
Fix define_custom_variable to preserve any sourcefile/sourceline information
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 5 Jan 2009 13:23:33 +0000 (13:23 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 5 Jan 2009 13:23:33 +0000 (13:23 +0000)
present in the placeholder.  Noted while testing pg_stat_statements.

src/backend/utils/misc/guc.c

index 303329167a818ff9e4842b48acb172ff722f2632..0f535c8fa03416f10607aa576575d1bb43a7f1b6 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut <peter_e@gmx.net>.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.488 2009/01/03 20:03:08 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.489 2009/01/05 13:23:33 tgl Exp $
  *
  *--------------------------------------------------------------------
  */
@@ -5747,9 +5747,17 @@ define_custom_variable(struct config_generic * variable)
        value = *pHolder->variable;
 
        if (value)
-               set_config_option(name, value,
-                                                 phcontext, pHolder->gen.source,
-                                                 GUC_ACTION_SET, true);
+       {
+               if (set_config_option(name, value,
+                                                         phcontext, pHolder->gen.source,
+                                                         GUC_ACTION_SET, true))
+               {
+                       /* Also copy over any saved source-location information */
+                       if (pHolder->gen.sourcefile)
+                               set_config_sourcefile(name, pHolder->gen.sourcefile,
+                                                                         pHolder->gen.sourceline);
+               }
+       }
 
        /*
         * Free up as much as we conveniently can of the placeholder structure