1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-16 17:07:43 +03:00

doc: Improve pgoutput documentation.

This commit updates the pgoutput documentation with the following changes:

- Specify the data type for each pgoutput option.
- Clarify the relationship between proto_version and options such as
   streaming and two_phase.
- Add a note on the use of pg_logical_slot_peek_changes and
   pg_logical_slot_get_changes with pgoutput.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Discussion: https://postgr.es/m/CAHGQGwFJTbygdhhjR_iP4Oem=Lo1xsptWWOq825uoW+hG_Lfnw@mail.gmail.com
This commit is contained in:
Fujii Masao
2025-08-19 18:54:27 +09:00
parent 34a62c2c7f
commit 38c5fbd97e
2 changed files with 69 additions and 51 deletions

View File

@@ -1224,7 +1224,7 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset
</row> </row>
<row> <row>
<entry role="func_table_entry"><para role="func_signature"> <entry id="pg-logical-slot-peek-binary-changes" role="func_table_entry"><para role="func_signature">
<indexterm> <indexterm>
<primary>pg_logical_slot_peek_binary_changes</primary> <primary>pg_logical_slot_peek_binary_changes</primary>
</indexterm> </indexterm>

View File

@@ -600,109 +600,112 @@ DETAIL: Synchronization could lead to data loss, because the remote slot needs
<title>Options</title> <title>Options</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry id="pgoutput-options-proto-version">
<term> <term><varname>proto_version</varname> (<type>integer</type>)</term>
proto_version
</term>
<listitem> <listitem>
<para> <para>
Protocol version. Currently versions <literal>1</literal>, <literal>2</literal>, Specifies the protocol version.
Currently versions <literal>1</literal>, <literal>2</literal>,
<literal>3</literal>, and <literal>4</literal> are supported. A valid <literal>3</literal>, and <literal>4</literal> are supported. A valid
version is required. version is required.
</para> </para>
<para> <para>
Version <literal>2</literal> is supported only for server version 14 Version <literal>2</literal> is supported on server version 14
and above, and it allows streaming of large in-progress transactions. and above, and is required when <varname>streaming</varname>
is set to <literal>on</literal> to stream large in-progress
transactions.
</para> </para>
<para> <para>
Version <literal>3</literal> is supported only for server version 15 Version <literal>3</literal> is supported on server version 15
and above, and it allows streaming of two-phase commits. and above, and is required when <varname>two_phase</varname>
is enabled to stream two-phase commits.
</para> </para>
<para> <para>
Version <literal>4</literal> is supported only for server version 16 Version <literal>4</literal> is supported on server version 16
and above, and it allows streams of large in-progress transactions to and above, and is required when <varname>streaming</varname>
be applied in parallel. is set to <literal>parallel</literal> to stream large in-progress
transactions to be applied in parallel.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="pgoutput-options-publication-names">
<term> <term><varname>publication_names</varname> (<type>string</type>)</term>
publication_names
</term>
<listitem> <listitem>
<para> <para>
Comma-separated list of publication names for which to subscribe A comma-separated list of publication names to subscribe to.
(receive changes). The individual publication names are treated The individual publication names are treated
as standard objects names and can be quoted the same as needed. as standard objects names and can be quoted the same as needed.
At least one publication name is required. At least one publication name is required.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="pgoutput-options-binary">
<term> <term><varname>binary</varname> (<type>boolean</type>)</term>
binary
</term>
<listitem> <listitem>
<para> <para>
Boolean option to use binary transfer mode. Binary mode is faster Enables binary transfer mode. Binary mode is faster
than the text mode but slightly less robust. than the text mode but slightly less robust.
The default is <literal>off</literal>. The default is <literal>off</literal>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="pgoutput-options-messages">
<term> <term><varname>messages</varname> (<type>boolean</type>)</term>
messages
</term>
<listitem> <listitem>
<para> <para>
Boolean option to enable sending the messages that are written Enables sending the messages that are written by
by <function>pg_logical_emit_message</function>. <function><link linkend="pg-logical-emit-message">pg_logical_emit_message</link></function>.
The default is <literal>off</literal>. The default is <literal>off</literal>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="pgoutput-options-streaming">
<term> <term><varname>streaming</varname> (<type>enum</type>)</term>
streaming
</term>
<listitem> <listitem>
<para> <para>
Option to enable streaming of in-progress transactions. Valid values are Enables streaming of in-progress transactions. Valid values are
<literal>off</literal> (the default), <literal>on</literal> and <literal>off</literal> (the default), <literal>on</literal> and
<literal>parallel</literal>. The setting <literal>parallel</literal> <literal>parallel</literal>.
enables sending extra information with some messages to be used for </para>
parallelization. Minimum protocol version 2 is required to turn it <para>
<literal>on</literal>. Minimum protocol version 4 is required for the When set to <literal>off</literal>, <filename>pgoutput</filename>
<literal>parallel</literal> value. fully decodes a transaction before sending it as a whole.
This mode works with any protocol version.
</para>
<para>
When set to <literal>on</literal>, <filename>pgoutput</filename>
streams large in-progress transactions.
This requires protocol version 2 or higher.
</para>
<para>
When set to <literal>parallel</literal>, <filename>pgoutput</filename>
streams large in-progress transactions and also sends
extra information in some messages to support parallel processing.
This requires protocol version 4 or higher.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="pgoutput-options-two-phase">
<term> <term><varname>two_phase</varname> (<type>boolean</type>)</term>
two_phase
</term>
<listitem> <listitem>
<para> <para>
Boolean option to enable two-phase transactions. Minimum protocol Enables sending two-phase transactions.
version 3 is required to turn it on. Minimum protocol version 3 is required to turn it on.
The default is <literal>off</literal>. The default is <literal>off</literal>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="pgoutput-options-origin">
<term> <term><varname>origin</varname> (<type>enum</type>)</term>
origin
</term>
<listitem> <listitem>
<para> <para>
Option to send changes by their origin. Possible values are Specifies whether to send changes by their origin. Possible values are
<literal>none</literal> to only send the changes that have no origin <literal>none</literal> to only send the changes that have no origin
associated, or <literal>any</literal> associated, or <literal>any</literal>
to send the changes regardless of their origin. This can be used to send the changes regardless of their origin. This can be used
@@ -715,6 +718,21 @@ DETAIL: Synchronization could lead to data loss, because the remote slot needs
</variablelist> </variablelist>
</sect3> </sect3>
<sect3 id="logicaldecoding-pgoutput-notes">
<title>Notes</title>
<para>
<filename>pgoutput</filename> produces binary output,
so functions expecting textual data (
<function><link linkend="pg-logical-slot-peek-changes">pg_logical_slot_peek_changes</link></function> and
<function><link linkend="pg-logical-slot-get-changes">pg_logical_slot_get_changes</link></function>)
cannot be used with it. Use
<function><link linkend="pg-logical-slot-peek-binary-changes">pg_logical_slot_peek_binary_changes</link></function> or
<function><link linkend="pg-logical-slot-get-binary-changes">pg_logical_slot_get_binary_changes</link></function>
instead.
</para>
</sect3>
</sect2> </sect2>
</sect1> </sect1>