mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Replicate generated columns when 'publish_generated_columns' is set.
This patch builds on the work done in commit 745217a051
by enabling the
replication of generated columns alongside regular column changes through
a new publication parameter: publish_generated_columns.
Example usage:
CREATE PUBLICATION pub1 FOR TABLE tab_gencol WITH (publish_generated_columns = true);
The column list takes precedence. If the generated columns are specified
in the column list, they will be replicated even if
'publish_generated_columns' is set to false. Conversely, if generated
columns are not included in the column list (assuming the user specifies a
column list), they will not be replicated even if
'publish_generated_columns' is true.
Author: Vignesh C, Shubham Khanna
Reviewed-by: Peter Smith, Amit Kapila, Hayato Kuroda, Shlok Kyal, Ajin Cherian, Hou Zhijie, Masahiko Sawada
Discussion: https://postgr.es/m/B80D17B2-2C8E-4C7D-87F2-E5B4BE3C069E@gmail.com
This commit is contained in:
@ -514,9 +514,11 @@ CREATE TABLE people (
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Generated columns can be replicated during logical replication by
|
||||
including them in the column list of the
|
||||
<command>CREATE PUBLICATION</command> command.
|
||||
Generated columns are allowed to be replicated during logical replication
|
||||
according to the <command>CREATE PUBLICATION</command> parameter
|
||||
<link linkend="sql-createpublication-params-with-publish-generated-columns">
|
||||
<literal>publish_generated_columns</literal></link> or by including them
|
||||
in the column list of the <command>CREATE PUBLICATION</command> command.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
@ -7477,7 +7477,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
|
||||
</variablelist>
|
||||
|
||||
<para>
|
||||
Next, one of the following submessages appears for each column:
|
||||
Next, one of the following submessages appears for each published column:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -189,6 +189,26 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="sql-createpublication-params-with-publish-generated-columns">
|
||||
<term><literal>publish_generated_columns</literal> (<type>boolean</type>)</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies whether the generated columns present in the tables
|
||||
associated with the publication should be replicated.
|
||||
The default is <literal>false</literal>.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
If the subscriber is from a release prior to 18, then initial table
|
||||
synchronization won't copy generated columns even if parameter
|
||||
<literal>publish_generated_columns</literal> is true in the
|
||||
publisher.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="sql-createpublication-params-with-publish-via-partition-root">
|
||||
<term><literal>publish_via_partition_root</literal> (<type>boolean</type>)</term>
|
||||
<listitem>
|
||||
|
Reference in New Issue
Block a user