postgresql_16:4.5.1.4 Parameter Interaction via the Shell
PostgreSQL 16 > Server Administration > Server Configuration > Setting Parameters > Parameter Interaction via the Shell
In addition to setting global defaults or attaching overrides at the database or role level, you can pass settings to PostgreSQL via shell facilities. Both the server and libpq client library accept parameter values via the shell.
- During server startup, parameter settings can be passed to the
postgrescommand via the-ccommand-line parameter. For example, postgres -c log_connections=yes -c log_destination='syslog' Settings provided in this way override those set viapostgresql.conforALTER SYSTEM, so they cannot be changed globally without restarting the server. - When starting a client session via libpq, parameter settings can be specified using the
PGOPTIONSenvironment variable. Settings established in this way constitute defaults for the life of the session, but do not affect other sessions. For historical reasons, the format ofPGOPTIONSis similar to that used when launching thepostgrescommand; specifically, the-cflag must be specified. For example, env PGOPTIONS="-c geqo=off -c statement_timeout=5min" psql
Other clients and libraries might provide their own mechanisms, via the shell or otherwise, that allow the user to alter session settings without direct use of SQL commands.