1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Prohibit combining publications with different column lists.

Currently, we simply combine the column lists when publishing tables on
multiple publications and that can sometimes lead to unexpected behavior.
Say, if a column is published in any row-filtered publication, then the
values for that column are sent to the subscriber even for rows that don't
match the row filter, as long as the row matches the row filter for any
other publication, even if that other publication doesn't include the
column.

The main purpose of introducing a column list is to have statically
different shapes on publisher and subscriber or hide sensitive column
data. In both cases, it doesn't seem to make sense to combine column
lists.

So, we disallow the cases where the column list is different for the same
table when combining publications. It can be later extended to combine the
column lists for selective cases where required.

Reported-by: Alvaro Herrera
Author: Hou Zhijie
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/202204251548.mudq7jbqnh7r@alvherre.pgsql
This commit is contained in:
Amit Kapila
2022-06-02 08:31:50 +05:30
parent 99f6f19799
commit fd0b9dcebd
6 changed files with 181 additions and 166 deletions

View File

@ -116,7 +116,17 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
<para>
Optionally, a column list can be specified. See <xref
linkend="sql-createpublication"/> for details.
linkend="sql-createpublication"/> for details. Note that a subscription
having several publications in which the same table has been published
with different column lists is not supported. So, changing the column
lists of the tables being subscribed could cause inconsistency of column
lists among publications, in which case <command>ALTER PUBLICATION</command>
will be successful but later the WalSender on the publisher or the
subscriber may throw an error. In this scenario, the user needs to
recreate the subscription after adjusting the column list or drop the
problematic publication using
<literal>ALTER SUBSCRIPTION ... DROP PUBLICATION</literal> and then add
it back after adjusting the column list.
</para>
<para>

View File

@ -355,6 +355,11 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
copied data that would be incompatible with subsequent filtering.
</para>
<para>
Subscriptions having several publications in which the same table has been
published with different column lists are not supported.
</para>
<para>
We allow non-existent publications to be specified so that users can add
those later. This means