Supported Versions: Current (17) / 16 / 15 / 14 / 13
Development Versions: devel
Unsupported versions: 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

17.14. Customized Options

This feature was designed to allow options not normally known to PostgreSQL to be added by add-on modules (such as procedural languages). This allows add-on modules to be configured in the standard ways.

custom_variable_classes (string)

This variable specifies one or several class names to be used for custom variables, in the form of a comma-separated list. A custom variable is a variable not normally known to PostgreSQL proper but used by some add-on module. Such variables must have names consisting of a class name, a dot, and a variable name. custom_variable_classes specifies all the class names in use in a particular installation. This option can be set at server start or in the postgresql.conf configuration file.

The difficulty with setting custom variables in postgresql.conf is that the file must be read before add-on modules have been loaded, and so custom variables would ordinarily be rejected as unknown. When custom_variable_classes is set, the server will accept definitions of arbitrary variables within each specified class. These variables will be treated as placeholders and will have no function until the module that defines them is loaded. When a module for a specific class is loaded, it will add the proper variable definitions for its class name, convert any placeholder values according to those definitions, and issue warnings for any placeholders of its class that remain (which presumably would be misspelled configuration variables).

Here is an example of what postgresql.conf might contain when using custom variables:

custom_variable_classes = 'plr,plperl'
plr.path = '/usr/lib/R'
plperl.use_strict = true
plruby.use_strict = true        # generates error: unknown class name