diff options
| author | Tomas Vondra | 2022-03-25 23:45:21 +0000 |
|---|---|---|
| committer | Tomas Vondra | 2022-03-26 00:01:27 +0000 |
| commit | 923def9a533a7d986acfb524139d8b9e5466d0a5 (patch) | |
| tree | b6ce8d5bfe8d932e3cc89e52aba68519558e8033 /src/include/commands | |
| parent | 05843b1aa49df2ecc9b97c693b755bd1b6f856a9 (diff) | |
Allow specifying column lists for logical replication
This allows specifying an optional column list when adding a table to
logical replication. The column list may be specified after the table
name, enclosed in parentheses. Columns not included in this list are not
sent to the subscriber, allowing the schema on the subscriber to be a
subset of the publisher schema.
For UPDATE/DELETE publications, the column list needs to cover all
REPLICA IDENTITY columns. For INSERT publications, the column list is
arbitrary and may omit some REPLICA IDENTITY columns. Furthermore, if
the table uses REPLICA IDENTITY FULL, column list is not allowed.
The column list can contain only simple column references. Complex
expressions, function calls etc. are not allowed. This restriction could
be relaxed in the future.
During the initial table synchronization, only columns included in the
column list are copied to the subscriber. If the subscription has
several publications, containing the same table with different column
lists, columns specified in any of the lists will be copied.
This means all columns are replicated if the table has no column list
at all (which is treated as column list with all columns), or when of
the publications is defined as FOR ALL TABLES (possibly IN SCHEMA that
matches the schema of the table).
For partitioned tables, publish_via_partition_root determines whether
the column list for the root or the leaf relation will be used. If the
parameter is 'false' (the default), the list defined for the leaf
relation is used. Otherwise, the column list for the root partition
will be used.
Psql commands \dRp+ and \d <table-name> now display any column lists.
Author: Tomas Vondra, Alvaro Herrera, Rahila Syed
Reviewed-by: Peter Eisentraut, Alvaro Herrera, Vignesh C, Ibrar Ahmed,
Amit Kapila, Hou zj, Peter Smith, Wang wei, Tang, Shi yu
Discussion: https://postgr.es/m/CAH2L28vddB_NFdRVpuyRBJEBWjz4BSyTB=_ektNRH8NJ1jf95g@mail.gmail.com
Diffstat (limited to 'src/include/commands')
| -rw-r--r-- | src/include/commands/publicationcmds.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/include/commands/publicationcmds.h b/src/include/commands/publicationcmds.h index 7813cbcb6bb..ae87caf089d 100644 --- a/src/include/commands/publicationcmds.h +++ b/src/include/commands/publicationcmds.h @@ -31,7 +31,9 @@ extern void RemovePublicationSchemaById(Oid psoid); extern ObjectAddress AlterPublicationOwner(const char *name, Oid newOwnerId); extern void AlterPublicationOwner_oid(Oid pubid, Oid newOwnerId); extern void InvalidatePublicationRels(List *relids); -extern bool contain_invalid_rfcolumn(Oid pubid, Relation relation, +extern bool pub_rf_contains_invalid_column(Oid pubid, Relation relation, + List *ancestors, bool pubviaroot); +extern bool pub_collist_contains_invalid_column(Oid pubid, Relation relation, List *ancestors, bool pubviaroot); #endif /* PUBLICATIONCMDS_H */ |
