[PATCHES] Configuration parameters for plugin modules

2004-05-09 Thread Thomas Hallgren
Posted this patch 2 weeks ago. Since then new changes has been made to 
guc.c making it hard to apply. Here's a new fresh version intended for 
current cvs head.

In short:
The patch adresses the TODO list item "Allow external interfaces to 
extend the GUC variable set".

Plugin modules like the pl modules needs a way to declare 
configuration parameters. The postmaster has no knowledge of such 
modules when it reads the postgresql.conf file. Rather than allowing 
totally unknown configuration parameters, the concept of a variable 
"class" is introduced. Variables that belongs to a declared classes will 
create a placeholder value of string type and will not generate an 
error. When a module is loaded, it will declare variables for such a 
class and make those variables "consume" any placeholders that has been 
defined. Finally, the module will generate warnings for unrecognized 
placeholders defined for its class.

More detail:
The design is outlined after the suggestions made by Tom Lane and Joe 
Conway in this thread:

http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.php

A new string variable 'custom_variable_classes' is introduced. This 
variable is a comma separated string of identifiers. Each identifier 
denots a 'class' that will allow its members to be added without error. 
This variable must be defined in postmaster.conf.

The lexer (guc_file.l) is changed so that it can accept a qualified name 
in the form . as the name of a variable. I also changed so that 
the 'custom_variable_classes', if found, is added first of all variables 
in order to remove the order of declaration issue.

The guc_variables table is made more dynamic. It is originally created 
with 20% slack and can grow dynamically. A capacity is introduced to 
avoid resizing every time a new variable is added. guc_variables and
num_guc_variables becomes static (hidden).

The GucInfoMain now uses the new function get_guc_variables() and 
GetNumConfigOptions  instead or using the guc_variables directly.

The find_option() function, when passed a missing name, will check if 
the name is qualified. If the name is qualified and if the qualifier 
denotes a class included in the 'custom_variable_classes', a placeholder 
variable will be created. Such a placeholder will not participate in a 
list operation but will otherwise function as a normal string variable.

DefineGucVariable() functions will be added, one for each variable 
type. They are inteded to be used by add-on modules like the pl 
mappings. Example:

extern void DefineCustomBoolVariable(
const char* name,
const char* short_desc,
const char* long_desc,
bool* valueAddr,
GucContext context,
GucBoolAssignHook assign_hook,
GucShowHook show_hook);
(I created typedefs for the assign-hook and show-hook functions). A call 
to these functions will define a new GUC-variable. If a placeholder 
exists it will be replaced but it's value will be used in place of the 
default value. The valueAddr is assumed ot point at a default value when 
the define function is called. The only constraint that is imposed on a 
Custom variable is that its name is qualified.

Finally, a function:

void EmittWarningsOnPlacholders(const char* className)

was added. This function should be called when a module has completed 
its variable definitions. At that time, no placeholders should remain 
for the class that the module uses. If they do, elog(INFO, ...) messages 
will be issued to inform the user that unrecognized variables are present.

Kind regards,

Thomas Hallgren
Index: doc/src/sgml/runtime.sgml
===
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/runtime.sgml,v
retrieving revision 1.263
diff -u -r1.263 runtime.sgml
--- doc/src/sgml/runtime.sgml   29 Apr 2004 04:37:09 -  1.263
+++ doc/src/sgml/runtime.sgml   9 May 2004 20:37:42 -
@@ -2924,6 +2924,60 @@
 

 
+   
+Customized Options
+
+
+ The following was designed to allow options not normally known to
+ PostgreSQL to be declared in the posgresql.conf
+ file and/or manipulated using the SET in a controlled
+ manner so that add-on modules to the postgres proper (such as lanugage
+ mappings for triggers and functions) can be configured in a unified way.
+
+
+
+
+ 
+  custom_variable_classes (string)
+  custom_variable_classes
+  
+   
+This variable specifies one or several classes to be used for custom
+variables. A custom variable is a variable not normally known to
+the PostgreSQL proper but used by some add
+on module.
+   
+
+   
+Aribtrary variables can be defined for each class specified here. Those
+variables will be treated as placeholders and have no meaning until the
+module that defines them is loaded. When a module for a specific class is
+loaded, it will add the p

Re: [PATCHES] mingw configure failure detection

2004-05-09 Thread Andrew Dunstan
Peter Eisentraut said:
> Andrew Dunstan wrote:
>> This patch for configure.in detects the link failures in MINGW that I
>> and others have seen and warns the user they have to fix it up.
>
> I continue to object to these sort of patches if no one wants to bother
>  to contact the mingw maintainers about this problem.  Maybe they have
> a  better fix available?
>

I have already said I would follow it up. But the problem exists today and
shouldn't be left until we get an answer. Maybe it will take a week or a
month, or there will be no good answer at all.

All this does is issue a warning.

This problem has happened to a number of users. So far the reponse has
largely been 'fix it by hand and move on'. I think our reputation is and
ought to be better than that.

> Btw. test -e is not portable.

Since this would only be run under Mingw, where it does work, why does
that matter?

> And please use AC_MSG_WARN instead of
> "echo".
>

I guess Bruce can make this change.

cheers

andrew



---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [PATCHES] mingw configure failure detection

2004-05-09 Thread Peter Eisentraut
Andrew Dunstan wrote:
> This patch for configure.in detects the link failures in MINGW that I
> and others have seen and warns the user they have to fix it up.

I continue to object to these sort of patches if no one wants to bother 
to contact the mingw maintainers about this problem.  Maybe they have a 
better fix available?

Btw. test -e is not portable.  And please use AC_MSG_WARN instead of 
"echo".


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]