↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / 配置参数

output_plugin_libraries

列出安装在 dynamic_library_path 所指定位置中、同时也受信任、可供复制客户端用作逻辑输出插件的库。任何针对其他库的逻辑解码或复制请求都将被拒绝。所有用户都受此限制。默认值为 'pgoutput, test_decoding',它们是标准 PostgreSQL 发行版中包含的两个逻辑输出插件。(表 19.2 说明了将它们从此列表中移除后系统的行为。) 其格式为以逗号分隔的库名称列表,每个名称的解释方式与 LOAD 命令相同(但逻辑解码客户端指定的插件名称必须与列表中的一个条目完全匹配,大小写或路径结构不得有变化)。条目之间的空白会被忽略;如果库名称中需要包含空白或逗号,请用双引号将其括起。 服务器管理员有责任确保,加载添加到此列表中的库时,不会无意中向非超级用户授予额外权限。 注意 从没有 output_plugin_libraries 参数的版本更新服务器时,以下查询可帮助构造所有持久逻辑复制槽所需的插件列表: SELECT DISTINCT plugin FROM pg_replication_slots WHERE plugin IS NOT NULL; 调整 output_plugin_libraries 之前,请仔细审查该列表以确保安全。 上述查询只能显示过去某个时刻已成功添加到复制槽的插件。新近被拒绝的请求将以类似以下消息出现在日志中: ERROR: library "..." may not be used as an output plugin DETAIL: The configuration parameter "output_plugin_libraries" (currently 'pgoutput, test_decoding') does not name this library as a trusted output plugin. HINT: If it is safe for all REPLICATION users to use this library as an output plugin, add it to "output_plugin_libraries" and reload the server configuration. 表 19.2. 默认允许的插件插件描述pgoutput 用于逻辑复制的核心插件。从 output_plugin_libraries 中移除 pgoutput,会导致后续订阅连接和订阅复制槽的维护报错失败。(请注意,服务器采用这种配置时,现有复制工具可能无法妥善处理这种情况。) test_decoding 将 WAL 流解码为人类可读的文本表示。pg_recvlogical 默认使用此插件,因此从 output_plugin_libraries 中移除它后,该工具将无法使用,除非安装了替代插件,并通过 --plugin 显式选择该插件。

英文手册覆盖始于 PostgreSQL 7.4. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 19·选择有来源记录的版本

boot val
pgoutput, test_decoding
category
Replication / Sending Servers
context
superuser
doc same as
未知
documented
true
enumvals
未知
extra desc
Users with REPLICATION privileges may only use plugins in this list when creating logical replication slots.
lang
en
max val
未知
metadata version
19beta4
min val
未知
name
output_plugin_libraries
short desc
Lists libraries that may be named as logical decoding output plugins.
source
pg-settings-source-snapshot
unit
未知
vartype
string

版本定义 PG 19

列出安装在 dynamic_library_path 所指定位置中、同时也受信任、可供复制客户端用作逻辑输出插件的库。任何针对其他库的逻辑解码或复制请求都将被拒绝。所有用户都受此限制。默认值为 'pgoutput, test_decoding',它们是标准 PostgreSQL 发行版中包含的两个逻辑输出插件。(表 19.2 说明了将它们从此列表中移除后系统的行为。)

其格式为以逗号分隔的库名称列表,每个名称的解释方式与 LOAD 命令相同(但逻辑解码客户端指定的插件名称必须与列表中的一个条目完全匹配,大小写或路径结构不得有变化)。条目之间的空白会被忽略;如果库名称中需要包含空白或逗号,请用双引号将其括起。

服务器管理员有责任确保,加载添加到此列表中的库时,不会无意中向非超级用户授予额外权限。

注意

从没有 output_plugin_libraries 参数的版本更新服务器时,以下查询可帮助构造所有持久逻辑复制槽所需的插件列表:

SELECT DISTINCT plugin FROM pg_replication_slots WHERE plugin IS NOT NULL;

调整 output_plugin_libraries 之前,请仔细审查该列表以确保安全。

上述查询只能显示过去某个时刻已成功添加到复制槽的插件。新近被拒绝的请求将以类似以下消息出现在日志中:

ERROR:  library "..." may not be used as an output plugin
DETAIL:  The configuration parameter "output_plugin_libraries" (currently 'pgoutput, test_decoding') does not name this library as a trusted output plugin.
HINT:  If it is safe for all REPLICATION users to use this library as an output plugin, add it to "output_plugin_libraries" and reload the server configuration.

表 19.2. 默认允许的插件

插件描述
pgoutput 用于逻辑复制的核心插件。从 output_plugin_libraries 中移除 pgoutput,会导致后续订阅连接和订阅复制槽的维护报错失败。(请注意,服务器采用这种配置时,现有复制工具可能无法妥善处理这种情况。)
test_decoding 将 WAL 流解码为人类可读的文本表示。pg_recvlogical 默认使用此插件,因此从 output_plugin_libraries 中移除它后,该工具将无法使用,除非安装了替代插件,并通过 --plugin 显式选择该插件。

比较版本

完整来源事实

doc html

<p>
         Lists the libraries installed in <a class="xref" href="/docs/19/runtime-config-client.html#GUC-DYNAMIC-LIBRARY-PATH">dynamic_library_path</a>
         that are also trusted for use as logical output plugins by replication
         clients. Any <a class="link" href="/docs/19/logicaldecoding-example.html" title="47.1. Logical Decoding Examples">logical decoding</a>
         or <a class="link" href="/docs/19/protocol-replication.html" title="54.4. Streaming Replication Protocol">replication</a> requests for
         other libraries will be refused. All users are subject to this
         restriction. The default is <code class="literal">'pgoutput, test_decoding'</code>,
         which are the two logical output plugins included in the standard
         <span class="productname">PostgreSQL</span> distribution.
         (<a class="xref" href="/docs/19/runtime-config-replication.html#GUC-OUTPUT-PLUGIN-LIBRARIES-BUILTINS" title="Table 19.2. Plugins Allowed by Default">Table 19.2</a> documents the
         behavior of the system if they are removed from this list.)
        </p><p>
         The format is a comma-separated list of library names, where each name
         is interpreted as for the <a class="link" href="/docs/19/sql-load.html" title="LOAD"><code class="command">LOAD</code></a>
         command (but logical decoding clients must specify a plugin name that
         <span class="emphasis"><em>exactly</em></span> matches an entry in the list, without
         variations in case or path structure). Whitespace between entries is
         ignored; surround a library name with double quotes if you need to
         include whitespace or commas in the name.
        </p><p>
         It is the responsibility of the server administrator to ensure that
         libraries added to this list do not unintentionally give additional
         privileges to non-superusers when they are loaded into the server.
        </p><div class="note"><h3 class="title">Note</h3><p>
          When updating the server from a version that does not have the
          <code class="literal">output_plugin_libraries</code> parameter, the following
          query can help construct the list of plugins that are required by all
          persistent logical replication slots:
</p><pre class="programlisting">
SELECT DISTINCT plugin FROM pg_replication_slots WHERE plugin IS NOT NULL;
</pre><p>
          Review the list carefully for safety before adjusting
          <code class="literal">output_plugin_libraries</code>.
         </p><p>
          The above query can only display plugins which were successfully
          added to replication slots at some point in the past. Newly refused
          requests will appear in the logs with a message similar to
</p><pre class="programlisting">
ERROR:  library "..." may not be used as an output plugin
DETAIL:  The configuration parameter "output_plugin_libraries" (currently 'pgoutput, test_decoding') does not name this library as a trusted output plugin.
HINT:  If it is safe for all REPLICATION users to use this library as an output plugin, add it to "output_plugin_libraries" and reload the server configuration.
</pre><p>
</p></div><div class="table" id="GUC-OUTPUT-PLUGIN-LIBRARIES-BUILTINS"><p class="title"><strong>Table 19.2. Plugins Allowed by Default</strong></p><div class="table-contents"><table border="1" class="table" summary="Plugins Allowed by Default"><colgroup><col class="col1"/><col class="col2"/></colgroup><thead><tr><th>Plugin</th><th>Description</th></tr></thead><tbody><tr><td><a class="xref" href="/docs/19/logicaldecoding-output-plugin.html#LOGICALDECODING-PGOUTPUT" title="47.6.1. pgoutput — Standard Logical Decoding Output Plugin">pgoutput</a></td><td>
             Core plugin for logical replication. Removing <code class="literal">pgoutput</code>
             from <code class="literal">output_plugin_libraries</code> will cause future
             subscription connections, and maintenance of the replication slots
             for subscriptions, to fail with an error. (Beware that existing
             replication tools may not degrade gracefully if the server is
             configured in this way.)
            </td></tr><tr><td><a class="xref" href="/docs/19/test-decoding.html" title="F.47. test_decoding — SQL-based test/example module for WAL logical decoding">test_decoding</a></td><td>
             Decodes the WAL stream into a human-readable text representation.
             <a class="xref" href="/docs/19/app-pgrecvlogical.html" title="pg_recvlogical"><span class="refentrytitle"><span class="application">pg_recvlogical</span></span></a> uses this plugin by default, so
             removing it from <code class="literal">output_plugin_libraries</code> will
             prevent the use of that utility unless a replacement plugin is
             installed and explicitly selected with
             <a class="link" href="/docs/19/app-pgrecvlogical.html#APP-PGRECVLOGICAL-OPTION-PLUGIN"><code class="literal">--plugin</code></a>.
            </td></tr></tbody></table></div></div><br class="table-break"/>

documentation revision

{"inputs":[{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"76b3c1615af7dd60d031cefd485568e6336b3d13c366e8a473304bd7ef2fb92d","version":"19rc2"},{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"935f29b71e863329c3c39caae902de37d5bbf03c2adcf42322225d3cefe71a84","version":"19rc2"}],"release":"19rc2","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 19 · wiki-repair-20261023:fc22a3604f909c1b2185e1a6082234de73f15a7683d102c5351c8387470806e8

正文语言: zh-Hans · wiki-repair-20261023:fc22a3604f909c1b2185e1a6082234de73f15a7683d102c5351c8387470806e8