[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [HACKERS] custom guc vars
From:       Brent Verner <brent () rcfile ! org>
Date:       2005-05-02 8:15:36
Message-ID: 20050502081536.GA22439 () rcfile ! org
[Download RAW message or body]

[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 majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic