1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Change publication's publish_generated_columns option type to enum.

The current boolean publish_generated_columns option only supports a
binary choice, which is insufficient for future enhancements where
generated columns can be of different types (e.g., stored or virtual). The
supported values for the publish_generated_columns option are 'none' and
'stored'.

Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/d718d219-dd47-4a33-bb97-56e8fc4da994@eisentraut.org
Discussion: https://postgr.es/m/B80D17B2-2C8E-4C7D-87F2-E5B4BE3C069E@gmail.com
This commit is contained in:
Amit Kapila
2025-01-23 15:28:37 +05:30
parent eef4a33f62
commit e65dbc9927
19 changed files with 394 additions and 230 deletions

View File

@ -6394,6 +6394,20 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>pubgencols</structfield> <type>char</type>
</para>
<para>
Controls how to handle generated column replication when there is no
publication column list:
<literal>n</literal> = generated columns in the tables associated with
the publication should not be replicated,
<literal>s</literal> = stored generated columns in the tables associated
with the publication should be replicated.
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>pubviaroot</structfield> <type>bool</type>

View File

@ -89,10 +89,10 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
<para>
When a column list is specified, only the named columns are replicated.
The column list can contain generated columns as well. If no column list
is specified, all table columns (except generated columns) are replicated
through this publication, including any columns added later. It has no
effect on <literal>TRUNCATE</literal> commands. See
The column list can contain stored generated columns as well. If no
column list is specified, all table columns (except generated columns)
are replicated through this publication, including any columns added
later. It has no effect on <literal>TRUNCATE</literal> commands. See
<xref linkend="logical-replication-col-lists"/> for details about column
lists.
</para>
@ -190,20 +190,31 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
</varlistentry>
<varlistentry id="sql-createpublication-params-with-publish-generated-columns">
<term><literal>publish_generated_columns</literal> (<type>boolean</type>)</term>
<term><literal>publish_generated_columns</literal> (<type>enum</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>.
associated with the publication should be replicated. Possible values
are <literal>none</literal> and <literal>stored</literal>.
</para>
<para>
The default is <literal>none</literal> meaning the generated
columns present in the tables associated with publication will not be
replicated.
</para>
<para>
If set to <literal>stored</literal>, the stored generated columns
present in the tables associated with publication will be replicated.
</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.
<literal>publish_generated_columns</literal> is <literal>stored</literal>
in the publisher.
</para>
</note>
</listitem>