Postgresql 中文操作指南

46.11. Environment Variables #

Python 解释器接受的一些环境变量也可以用来影响 PL/Python 行为。需要在 PostgreSQL 服务器主进程的环境中设置这些变量,例如在启动脚本中。可用环境变量取决于 Python 的版本;有关详细信息,请参见 Python 文档。编写本文时,以下环境变量会对 PL/Python 产生影响,假设 Python 版本足够:

Some of the environment variables that are accepted by the Python interpreter can also be used to affect PL/Python behavior. They would need to be set in the environment of the main PostgreSQL server process, for example in a start script. The available environment variables depend on the version of Python; see the Python documentation for details. At the time of this writing, the following environment variables have an affect on PL/Python, assuming an adequate Python version:

(这似乎是 PL/Python 无法控制的 Python 实现细节,python 手册页面上列出的一些环境变量仅在命令行解释器中有效,而在嵌入式 Python 解释器中无效。)

(It appears to be a Python implementation detail beyond the control of PL/Python that some of the environment variables listed on the python man page are only effective in a command-line interpreter and not an embedded Python interpreter.)