Re: Extensions, this time with a patch - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Extensions, this time with a patch
Date
Msg-id m2vd3oh2gh.fsf@2ndQuadrant.fr
Whole thread Raw
In response to Re: Extensions, this time with a patch  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Hmm, the first thought that comes to mind is that the GucContext param
> to ParseConfigFile is unused and can be removed.  This is probably an
> oversight from when include files were introduced in 2006.

Thanks for caring about that part.

> I don't like the fact that this code handles custom_variable_classes
> internally.  I think this would be exposed to the parsing of extension
> control files, which is obviously wrong.

Well, in fact, not that much. The extension code has a special error
case when dealing with custom variables if the class hasn't been already
parsed, and what ParseConfigFile() is doing is pushing the
custom_variable_classes setting in front of the list.

guc-file.l says:        /*         * This variable must be processed first as it controls         * the validity of
othervariables; so it goes at the head         * of the result list.  If we already found a value for it,         *
replacewith this one.         */
 

extension.c says:        ereport(ERROR,                (errmsg("Unsupported parameter '%s' in file: %s",
       tok1, filename),                 errhint("Be sure to have 'custom_variable_classes' set "
"in a line before any custom variable.")));
 

So if we don't change the code in ParseConfigFile() that will push
custom_variable_classes in front of the list, all I have to change in
the extension.c file is the error message.

I fail to see a future usage of custom_variable_classes where it
wouldn't help to have that in the list before any user setting that
depends on it.

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: ALTER OBJECT any_name SET SCHEMA name
Next
From: Heikki Linnakangas
Date:
Subject: Re: visibility map