Postgresql 中文操作指南

34.15. Environment Variables #

如果调用代码未直接指定值,可以利用以下环境变量来选择默认连接参数值,此值将由 PQconnectdbPQsetdbLoginPQsetdb 使用。例如,这可以有效避免在简单的客户端应用程序中对数据库连接信息进行硬编码。

The following environment variables can be used to select default connection parameter values, which will be used by PQconnectdb, PQsetdbLogin and PQsetdb if no value is directly specified by the calling code. These are useful to avoid hard-coding database connection information into simple client applications, for example.

可以利用以下环境变量来指定每个 PostgreSQL 会话的默认行为。(另请参阅 ALTER ROLEALTER DATABASE 命令,了解按用户或按数据库设定默认行为的方法)。

The following environment variables can be used to specify default behavior for each PostgreSQL session. (See also the ALTER ROLE and ALTER DATABASE commands for ways to set default behavior on a per-user or per-database basis.)

有关这些环境变量正确值的详细信息,请参阅 SQL 命令 SET

Refer to the SQL command SET for information on correct values for these environment variables.

以下环境变量确定 libpq 的内部行为;它们会覆盖已编译的默认值。

The following environment variables determine internal behavior of libpq; they override compiled-in defaults.