[2005-05-01 18:38] Andrew Dunstan said:
| 
| Is there a readme somewhere on how modules are supposed to use custom 
| GUC variables? If there is I have missed it.

  I don't think there is any documentation for this, but here's a
simple overview.

cheers.
        Brent

=== postgresql.conf ===

  custom_variable_classes = 'mymodule, anothermodule'
  mymodule.integer = 10
  mymodule.double = 5.5
  mymodule.string = 'some string'
  mymodule.bool = true
  anothermodule.whatever = 'some string'
  anothermodule.other = false


=== moduleConfig.c ===

  #include <utils/guc.h>

  int anIntVar;
  char* aStringVar;
  double aDoubleVar;
  bool aBoolVar;

  void setCustomVars()
  {
    DefineCustomIntegerVariable(
        "mymodule.integer",
        "A custom integer guc var",
        NULL,
        &anIntVar,
        PGC_USERSET,
        NULL,NULL);

    DefineCustomStringVariable(
        "mymodule.string",
        "A custom string guc var",
        NULL,
        &aStringVar,
        PGC_USERSET,
        NULL,NULL);

    DefineCustomRealVariable(
        "mymodule.double",
        "A custom double guc var",
        NULL,
        &aDoubleVar,
        PGC_USERSET,
        NULL,NULL);

    DefineCustomBoolVariable(
        "mymodule.bool",
        "A custom bool guc var",
        NULL,
        &aBoolVar,
        PGC_USERSET,
        NULL,NULL);
  }


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to