Re: Extensions, this time with a patch

From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Extensions, this time with a patch
Date: 2010-11-23 08:24:46
Message-ID: m2vd3oh2gh.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)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 other variables; so it goes at the head
* of the result list. If we already found a value for it,
* replace with 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2010-11-23 08:42:13 Re: visibility map
Previous Message Dimitri Fontaine 2010-11-23 08:18:56 Re: ALTER OBJECT any_name SET SCHEMA name