55.25. pg_settings #
The view pg_settings provides access to run-time parameters of the server. It is essentially an alternative interface to the SHOW and SET commands. It also provides access to some facts about each parameter that are not directly available from SHOW, such as minimum and maximum values.
Table 55.25. pg_settings Columns
Column Type Description |
|---|
Run-time configuration parameter name |
Current value of the parameter |
Implicit unit of the parameter |
Logical group of the parameter |
A brief description of the parameter |
Additional, more detailed, description of the parameter |
Context required to set the parameter's value (see below) |
Parameter type ( |
Source of the current parameter value |
Minimum allowed value of the parameter (null for non-numeric values) |
Maximum allowed value of the parameter (null for non-numeric values) |
Allowed values of an enum parameter (null for non-enum values) |
Parameter value assumed at server startup if the parameter is not otherwise set |
Value that |
Configuration file the current value was set in (null for values set from sources other than configuration files, or when examined by a user who neither is a superuser nor has privileges of |
Line number within the configuration file the current value was set at (null for values set from sources other than configuration files, or when examined by a user who neither is a superuser nor has privileges of |
|
There are several possible values of context. In order of decreasing difficulty of changing the setting, they are:
internalThese settings cannot be changed directly; they reflect internally determined values. Some of them may be adjustable by rebuilding the server with different configuration options, or by changing options supplied to initdb.
postmasterThese settings can only be applied when the server starts, so any change requires restarting the server. Values for these settings are typically stored in the
postgresql.conffile, or passed on the command line when starting the server. Of course, settings with any of the lowercontexttypes can also be set at server start time.sighupChanges to these settings can be made in
postgresql.confwithout restarting the server. Send a SIGHUP signal to the postmaster to cause it to re-readpostgresql.confand apply the changes. The postmaster will also forward the SIGHUP signal to its child processes so that they all pick up the new value.superuser-backendChanges to these settings can be made in
postgresql.confwithout restarting the server. They can also be set for a particular session in the connection request packet (for example, via libpq'sPGOPTIONSenvironment variable), but only if the connecting user is a superuser or has been granted the appropriateSETprivilege. However, these settings never change in a session after it is started. If you change them inpostgresql.conf, send a SIGHUP signal to the postmaster to cause it to re-readpostgresql.conf. The new values will only affect subsequently-launched sessions.backendChanges to these settings can be made in
postgresql.confwithout restarting the server. They can also be set for a particular session in the connection request packet (for example, via libpq'sPGOPTIONSenvironment variable); any user can make such a change for their session. However, these settings never change in a session after it is started. If you change them inpostgresql.conf, send a SIGHUP signal to the postmaster to cause it to re-readpostgresql.conf. The new values will only affect subsequently-launched sessions.superuserThese settings can be set from
postgresql.conf, or within a session via theSETcommand; but only superusers and users with the appropriateSETprivilege can change them viaSET. Changes inpostgresql.confwill affect existing sessions only if no session-local value has been established withSET.userThese settings can be set from
postgresql.conf, or within a session via theSETcommand. Any user is allowed to change their session-local value. Changes inpostgresql.confwill affect existing sessions only if no session-local value has been established withSET.
See Section 19.1 for more information about the various ways to change these parameters.
This view cannot be inserted into or deleted from, but it can be updated. An UPDATE applied to a row of pg_settings is equivalent to executing the SET command on that named parameter. The change only affects the value used by the current session. If an UPDATE is issued within a transaction that is later aborted, the effects of the UPDATE command disappear when the transaction is rolled back. Once the surrounding transaction is committed, the effects will persist until the end of the session, unless overridden by another UPDATE or SET.
This view does not display customized options unless the extension module that defines them has been loaded by the backend process executing the query (e.g., via a mention in shared_preload_libraries, a call to a C function in the extension, or the LOAD command). For example, since archive modules are normally loaded only by the archiver process not regular sessions, this view will not display any customized options defined by such modules unless special action is taken to load them into the backend process executing the query.