From 7054186c4ebe24e63254651e2ae9b36efae90d4e Mon Sep 17 00:00:00 2001
From: Amit Kapila
Date: Thu, 7 Nov 2024 08:58:49 +0530
Subject: 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
---
doc/src/sgml/ddl.sgml | 8 +++++---
doc/src/sgml/protocol.sgml | 2 +-
doc/src/sgml/ref/create_publication.sgml | 20 ++++++++++++++++++++
3 files changed, 26 insertions(+), 4 deletions(-)
(limited to 'doc/src')
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 (
- Generated columns can be replicated during logical replication by
- including them in the column list of the
- CREATE PUBLICATION command.
+ Generated columns are allowed to be replicated during logical replication
+ according to the CREATE PUBLICATION parameter
+
+ publish_generated_columns or by including them
+ in the column list of the CREATE PUBLICATION command.
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;"
- Next, one of the following submessages appears for each column:
+ Next, one of the following submessages appears for each published column:
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 name
+
+ publish_generated_columns (boolean)
+
+
+ Specifies whether the generated columns present in the tables
+ associated with the publication should be replicated.
+ The default is false.
+
+
+
+
+ If the subscriber is from a release prior to 18, then initial table
+ synchronization won't copy generated columns even if parameter
+ publish_generated_columns is true in the
+ publisher.
+
+
+
+
+
publish_via_partition_root (boolean)
--
cgit v1.2.3