diff options
author | Amit Kapila <akapila@postgresql.org> | 2024-11-07 08:58:49 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2024-11-07 08:58:49 +0530 |
commit | 7054186c4ebe24e63254651e2ae9b36efae90d4e (patch) | |
tree | 56f43479b5f7c127128b91697da9db84242bc67e /doc/src | |
parent | 70291a3c66eca599fd9f59f7f6051432b2020f4b (diff) | |
download | postgresql-7054186c4ebe24e63254651e2ae9b36efae90d4e.tar.gz postgresql-7054186c4ebe24e63254651e2ae9b36efae90d4e.zip |
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
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ddl.sgml | 8 | ||||
-rw-r--r-- | doc/src/sgml/protocol.sgml | 2 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_publication.sgml | 20 |
3 files changed, 26 insertions, 4 deletions
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index f02f67d7b86..898b6ddc8df 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -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> diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml index 71b6b2a535f..4c0a1a00688 100644 --- a/doc/src/sgml/protocol.sgml +++ b/doc/src/sgml/protocol.sgml @@ -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> diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml index d2cac06fd76..f8e217d6610 100644 --- a/doc/src/sgml/ref/create_publication.sgml +++ b/doc/src/sgml/ref/create_publication.sgml @@ -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> |