0001-fixup-Allow-specifying-column-filters-for-logical-re.patch
text/plain
Filename: 0001-fixup-Allow-specifying-column-filters-for-logical-re.patch
Type: text/plain
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0001
Subject: fixup! Allow specifying column filters for logical replication
| File | + | − |
|---|---|---|
| doc/src/sgml/catalogs.sgml | 2 | 2 |
| doc/src/sgml/protocol.sgml | 2 | 3 |
| doc/src/sgml/ref/alter_publication.sgml | 4 | 0 |
| src/backend/catalog/pg_publication.c | 8 | 12 |
| src/backend/commands/publicationcmds.c | 40 | 40 |
| src/backend/executor/execReplication.c | 4 | 4 |
| src/backend/replication/logical/proto.c | 11 | 10 |
| src/backend/replication/logical/tablesync.c | 8 | 8 |
| src/backend/replication/pgoutput/pgoutput.c | 1 | 1 |
| src/backend/utils/cache/relcache.c | 12 | 13 |
| src/bin/psql/describe.c | 1 | 1 |
| src/include/catalog/pg_publication.h | 3 | 4 |
| src/include/commands/publicationcmds.h | 2 | 2 |
| src/test/regress/expected/publication.out | 67 | 67 |
| src/test/regress/sql/publication.sql | 45 | 45 |
| src/test/subscription/t/029_column_list.pl | 25 | 25 |
From d0e9df4674389cda9f891f5678f476d35095c618 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 8 Mar 2022 16:23:01 +0100
Subject: [PATCH] fixup! Allow specifying column filters for logical
replication
---
doc/src/sgml/catalogs.sgml | 4 +-
doc/src/sgml/protocol.sgml | 5 +-
doc/src/sgml/ref/alter_publication.sgml | 4 +
src/backend/catalog/pg_publication.c | 20 ++-
src/backend/commands/publicationcmds.c | 80 ++++++------
src/backend/executor/execReplication.c | 8 +-
src/backend/replication/logical/proto.c | 21 +--
src/backend/replication/logical/tablesync.c | 16 +--
src/backend/replication/pgoutput/pgoutput.c | 2 +-
src/backend/utils/cache/relcache.c | 25 ++--
src/bin/psql/describe.c | 2 +-
src/include/catalog/pg_publication.h | 7 +-
src/include/commands/publicationcmds.h | 4 +-
src/test/regress/expected/publication.out | 134 ++++++++++----------
src/test/regress/sql/publication.sql | 90 ++++++-------
src/test/subscription/t/029_column_list.pl | 50 ++++----
16 files changed, 235 insertions(+), 237 deletions(-)
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 2b61f42b71..c043da37ae 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -4392,7 +4392,7 @@ <title><structname>pg_index</structname> Columns</title>
</para>
<para>
This is an array of <structfield>indnatts</structfield> values that
- indicate which table columns this index indexes. For example a value
+ indicate which table columns this index indexes. For example, a value
of <literal>1 3</literal> would mean that the first and the third table
columns make up the index entries. Key columns come before non-key
(included) columns. A zero in this array indicates that the
@@ -6271,7 +6271,7 @@ <title><structname>pg_publication_namespace</structname> Columns</title>
</para>
<para>
This is an array of values that indicates which table columns are
- part of the publication. For example a value of <literal>1 3</literal>
+ part of the publication. For example, a value of <literal>1 3</literal>
would mean that the first and the third table columns are published.
A null value indicates that all columns are published.
</para></entry>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 496593201b..6f4d76ef7f 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -7005,9 +7005,8 @@ <title>Logical Replication Message Formats</title>
</listitem>
</varlistentry>
</variablelist>
- Next, the following message part appears for each column (except
- generated columns and other columns that don't appear in the column
- filter list, for tables that have one):
+ Next, the following message part appears for each column included in
+ the publication (except generated columns):
<variablelist>
<varlistentry>
<term>
diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml
index aa6827c977..470d50a244 100644
--- a/doc/src/sgml/ref/alter_publication.sgml
+++ b/doc/src/sgml/ref/alter_publication.sgml
@@ -119,10 +119,14 @@ <title>Parameters</title>
specified, the table and all its descendant tables (if any) are
affected. Optionally, <literal>*</literal> can be specified after the table
name to explicitly indicate that descendant tables are included.
+ </para>
+ <para>
Optionally, a column list can be specified. See <xref
linkend="sql-createpublication"/> for details.
+ </para>
+ <para>
If the optional <literal>WHERE</literal> clause is specified, rows for
which the <replaceable class="parameter">expression</replaceable>
evaluates to false or null will not be published. Note that parentheses
diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 4dab96265f..3275a7c8b9 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -333,7 +333,6 @@ publication_add_relation(Oid pubid, PublicationRelInfo *pri,
Publication *pub = GetPublication(pubid);
AttrNumber *attarray;
int natts = 0;
- int i;
ObjectAddress myself,
referenced;
List *relids = NIL;
@@ -381,7 +380,7 @@ publication_add_relation(Oid pubid, PublicationRelInfo *pri,
values[Anum_pg_publication_rel_prrelid - 1] =
ObjectIdGetDatum(relid);
- /* Add column filter, if available */
+ /* Add column list, if available */
if (pri->columns)
{
int2vector *prattrs;
@@ -408,7 +407,7 @@ publication_add_relation(Oid pubid, PublicationRelInfo *pri,
ObjectAddressSet(myself, PublicationRelRelationId, pubreloid);
/* Add dependency on the columns, if any are listed */
- for (i = 0; i < natts; i++)
+ for (int i = 0; i < natts; i++)
{
ObjectAddressSubSet(referenced, RelationRelationId, relid, attarray[i]);
recordDependencyOn(&myself, &referenced, DEPENDENCY_AUTO);
@@ -461,7 +460,6 @@ publication_set_table_columns(Relation pubrel, HeapTuple pubreltup,
bool nulls[Natts_pg_publication_rel];
bool replaces[Natts_pg_publication_rel];
Datum values[Natts_pg_publication_rel];
- int i;
memset(values, 0, sizeof(values));
memset(nulls, false, sizeof(nulls));
@@ -480,14 +478,14 @@ publication_set_table_columns(Relation pubrel, HeapTuple pubreltup,
}
else
{
- ObjectAddress myself,
+ ObjectAddress myself,
referenced;
int2vector *prattrs;
Form_pg_publication_rel pubrel;
publication_translate_columns(targetrel, columns, &natts, &attarray);
- /* XXX "pub" is leaked here */
+ /* XXX "pub" is leaked here ??? */
prattrs = buildint2vector(attarray, natts);
values[Anum_pg_publication_rel_prattrs - 1] = PointerGetDatum(prattrs);
@@ -496,7 +494,7 @@ publication_set_table_columns(Relation pubrel, HeapTuple pubreltup,
pubrel = (Form_pg_publication_rel) GETSTRUCT(pubreltup);
ObjectAddressSet(myself, PublicationRelRelationId, pubrel->oid);
- for (i = 0; i < natts; i++)
+ for (int i = 0; i < natts; i++)
{
ObjectAddressSubSet(referenced, RelationRelationId,
RelationGetRelid(targetrel), attarray[i]);
@@ -713,11 +711,10 @@ GetRelationColumnPartialPublications(Oid relid)
{
CatCList *pubrellist;
List *pubs = NIL;
- int i;
pubrellist = SearchSysCacheList1(PUBLICATIONRELMAP,
ObjectIdGetDatum(relid));
- for (i = 0; i < pubrellist->n_members; i++)
+ for (int i = 0; i < pubrellist->n_members; i++)
{
HeapTuple tup = &pubrellist->members[i]->tuple;
bool isnull;
@@ -727,7 +724,7 @@ GetRelationColumnPartialPublications(Oid relid)
Anum_pg_publication_rel_prattrs,
&isnull);
- /* no column filter for this publications/relation */
+ /* no column list for this publications/relation */
if (isnull)
continue;
@@ -756,7 +753,6 @@ GetRelationColumnListInPublication(Oid relid, Oid pubid)
int nelems;
int16 *elems;
List *attnos = NIL;
- int i;
tup = SearchSysCache2(PUBLICATIONRELMAP,
ObjectIdGetDatum(relid),
@@ -774,7 +770,7 @@ GetRelationColumnListInPublication(Oid relid, Oid pubid)
nelems = ARR_DIMS(arr)[0];
elems = (int16 *) ARR_DATA_PTR(arr);
- for (i = 0; i < nelems; i++)
+ for (int i = 0; i < nelems; i++)
attnos = lappend_oid(attnos, elems[i]);
ReleaseSysCache(tup);
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index fa1462ae54..b32ec27555 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -296,7 +296,7 @@ contain_invalid_rfcolumn_walker(Node *node, rf_context *context)
* Returns true if any invalid column is found.
*/
bool
-contain_invalid_rfcolumn(Oid pubid, Relation relation, List *ancestors,
+pub_rf_contains_invalid_column(Oid pubid, Relation relation, List *ancestors,
bool pubviaroot)
{
HeapTuple rftuple;
@@ -368,28 +368,28 @@ contain_invalid_rfcolumn(Oid pubid, Relation relation, List *ancestors,
}
/*
- * Check if all columns referenced in the column filter are part of the
+ * Check if all columns referenced in the column list are part of the
* REPLICA IDENTITY index or not.
*
* Returns true if any invalid column is found.
*/
bool
-contain_invalid_cfcolumn(Oid pubid, Relation relation, List *ancestors,
+pub_collist_contains_invalid_column(Oid pubid, Relation relation, List *ancestors,
bool pubviaroot)
{
- HeapTuple cftuple;
+ HeapTuple tuple;
Oid relid = RelationGetRelid(relation);
Oid publish_as_relid = RelationGetRelid(relation);
bool result = false;
- Datum cfdatum;
- bool cfisnull;
+ Datum datum;
+ bool isnull;
/*
* For a partition, if pubviaroot is true, find the topmost ancestor that
- * is published via this publication as we need to use its column filter
+ * is published via this publication as we need to use its column list
* for the changes.
*
- * Note that even though the column filter used is for an ancestor, the
+ * Note that even though the column list used is for an ancestor, the
* REPLICA IDENTITY used will be for the actual child table.
*/
if (pubviaroot && relation->rd_rel->relispartition)
@@ -400,24 +400,24 @@ contain_invalid_cfcolumn(Oid pubid, Relation relation, List *ancestors,
publish_as_relid = relid;
}
- cftuple = SearchSysCache2(PUBLICATIONRELMAP,
+ tuple = SearchSysCache2(PUBLICATIONRELMAP,
ObjectIdGetDatum(publish_as_relid),
ObjectIdGetDatum(pubid));
- if (!HeapTupleIsValid(cftuple))
+ if (!HeapTupleIsValid(tuple))
return false;
- cfdatum = SysCacheGetAttr(PUBLICATIONRELMAP, cftuple,
+ datum = SysCacheGetAttr(PUBLICATIONRELMAP, tuple,
Anum_pg_publication_rel_prattrs,
- &cfisnull);
+ &isnull);
- if (!cfisnull)
+ if (!isnull)
{
int x;
Bitmapset *idattrs;
Bitmapset *columns = NULL;
- /* With REPLICA IDENTITY FULL, no column filter is allowed. */
+ /* With REPLICA IDENTITY FULL, no column list is allowed. */
if (relation->rd_rel->relreplident == REPLICA_IDENTITY_FULL)
result = true;
@@ -426,7 +426,7 @@ contain_invalid_cfcolumn(Oid pubid, Relation relation, List *ancestors,
int nelems;
int16 *elems;
- arr = DatumGetArrayTypeP(cfdatum);
+ arr = DatumGetArrayTypeP(datum);
nelems = ARR_DIMS(arr)[0];
elems = (int16 *) ARR_DATA_PTR(arr);
@@ -441,7 +441,7 @@ contain_invalid_cfcolumn(Oid pubid, Relation relation, List *ancestors,
/*
* Attnums in the bitmap returned by RelationGetIndexAttrBitmap are
- * offset (to handle system columns the usual way), while column filter
+ * offset (to handle system columns the usual way), while column list
* does not use offset, so we can't do bms_is_subset(). Instead, we have
* to loop over the idattrs and check all of them are in the filter.
*/
@@ -479,7 +479,7 @@ contain_invalid_cfcolumn(Oid pubid, Relation relation, List *ancestors,
bms_free(columns);
}
- ReleaseSysCache(cftuple);
+ ReleaseSysCache(tuple);
return result;
}
@@ -733,7 +733,7 @@ TransformPubWhereClauses(List *tables, const char *queryString,
* XXX The name is a bit misleading, because we don't really transform
* anything here - we merely check the column list is compatible with the
* definition of the publication (with publish_via_partition_root=false)
- * we only allow filters on the leaf relations. So maybe rename it?
+ * we only allow column lists on the leaf relations. So maybe rename it?
*/
static void
TransformPubColumnList(List *tables, const char *queryString,
@@ -750,7 +750,7 @@ TransformPubColumnList(List *tables, const char *queryString,
/*
* If the publication doesn't publish changes via the root partitioned
- * table, the partition's column filter will be used. So disallow using
+ * table, the partition's column list will be used. So disallow using
* the column list on partitioned table in this case.
*/
if (!pubviaroot &&
@@ -988,8 +988,8 @@ AlterPublicationOptions(ParseState *pstate, AlterPublicationStmt *stmt,
/*
* If the publication doesn't publish changes via the root partitioned
- * table, the partition's row and column filter will be used. So disallow
- * using WHERE clause and column filters on partitioned table in this case.
+ * table, the partition's row filter and column list will be used. So disallow
+ * using WHERE clause and column lists on partitioned table in this case.
*/
if (!pubform->puballtables && publish_via_partition_root_given &&
!publish_via_partition_root)
@@ -997,7 +997,7 @@ AlterPublicationOptions(ParseState *pstate, AlterPublicationStmt *stmt,
/*
* Lock the publication so nobody else can do anything with it. This
* prevents concurrent alter to add partitioned table(s) with WHERE
- * clause(s) and/or column filters which we don't allow when not
+ * clause(s) and/or column lists which we don't allow when not
* publishing via root.
*/
LockDatabaseObject(PublicationRelationId, pubform->oid, 0,
@@ -1010,7 +1010,7 @@ AlterPublicationOptions(ParseState *pstate, AlterPublicationStmt *stmt,
{
HeapTuple rftuple;
Oid relid = lfirst_oid(lc);
- bool has_column_filter;
+ bool has_column_list;
bool has_row_filter;
rftuple = SearchSysCache2(PUBLICATIONRELMAP,
@@ -1020,11 +1020,11 @@ AlterPublicationOptions(ParseState *pstate, AlterPublicationStmt *stmt,
has_row_filter
= !heap_attisnull(rftuple, Anum_pg_publication_rel_prqual, NULL);
- has_column_filter
+ has_column_list
= !heap_attisnull(rftuple, Anum_pg_publication_rel_prattrs, NULL);
if (HeapTupleIsValid(rftuple) &&
- (has_row_filter || has_column_filter))
+ (has_row_filter || has_column_list))
{
HeapTuple tuple;
@@ -1046,13 +1046,13 @@ AlterPublicationOptions(ParseState *pstate, AlterPublicationStmt *stmt,
"publish_via_partition_root")));
if ((relform->relkind == RELKIND_PARTITIONED_TABLE) &&
- has_column_filter)
+ has_column_list)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("cannot set %s for publication \"%s\"",
"publish_via_partition_root = false",
stmt->pubname),
- errdetail("The publication contains a column filter for a partitioned table \"%s\" "
+ errdetail("The publication contains a column list for a partitioned table \"%s\" "
"which is not allowed when %s is false.",
NameStr(relform->relname),
"publish_via_partition_root")));
@@ -1067,7 +1067,7 @@ AlterPublicationOptions(ParseState *pstate, AlterPublicationStmt *stmt,
/*
* FIXME check pubactions vs. replica identity, to ensure the replica
- * identity is included in the column filter. Only do this for update
+ * identity is included in the column list. Only do this for update
* and delete publications. See check_publication_columns.
*
* XXX This is needed because publish_via_partition_root may change,
@@ -1261,7 +1261,7 @@ AlterPublicationTables(AlterPublicationStmt *stmt, HeapTuple tup,
/*
* See if the existing relation currently has a WHERE clause or a
- * column filter. We need to compare those too.
+ * column list. We need to compare those too.
*/
if (HeapTupleIsValid(rftuple))
{
@@ -1313,7 +1313,7 @@ AlterPublicationTables(AlterPublicationStmt *stmt, HeapTuple tup,
newrelid = RelationGetRelid(newpubrel->relation);
/*
- * If the new publication has column filter, transform it to
+ * If the new publication has column list, transform it to
* a bitmap too.
*/
if (newpubrel->columns)
@@ -1710,7 +1710,7 @@ OpenTableList(List *tables)
List *rels = NIL;
ListCell *lc;
List *relids_with_rf = NIL;
- List *relids_with_cf = NIL;
+ List *relids_with_collist = NIL;
/*
* Open, share-lock, and check all the explicitly-specified relations
@@ -1745,11 +1745,11 @@ OpenTableList(List *tables)
errmsg("conflicting or redundant WHERE clauses for table \"%s\"",
RelationGetRelationName(rel))));
- /* Disallow duplicate tables if there are any with column filters. */
- if (t->columns || list_member_oid(relids_with_cf, myrelid))
+ /* Disallow duplicate tables if there are any with column lists. */
+ if (t->columns || list_member_oid(relids_with_collist, myrelid))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
- errmsg("conflicting or redundant column filters for table \"%s\"",
+ errmsg("conflicting or redundant column lists for table \"%s\"",
RelationGetRelationName(rel))));
table_close(rel, ShareUpdateExclusiveLock);
@@ -1767,7 +1767,7 @@ OpenTableList(List *tables)
relids_with_rf = lappend_oid(relids_with_rf, myrelid);
if (t->columns)
- relids_with_cf = lappend_oid(relids_with_cf, myrelid);
+ relids_with_collist = lappend_oid(relids_with_collist, myrelid);
/*
* Add children of this rel, if requested, so that they too are added
@@ -1809,15 +1809,15 @@ OpenTableList(List *tables)
RelationGetRelationName(rel))));
/*
- * We don't allow to specify column filter for both parent
+ * We don't allow to specify column list for both parent
* and child table at the same time as it is not very
* clear which one should be given preference.
*/
if (childrelid != myrelid &&
- (t->columns || list_member_oid(relids_with_cf, childrelid)))
+ (t->columns || list_member_oid(relids_with_collist, childrelid)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
- errmsg("conflicting or redundant column fiters for table \"%s\"",
+ errmsg("conflicting or redundant column lists for table \"%s\"",
RelationGetRelationName(rel))));
continue;
@@ -1837,8 +1837,8 @@ OpenTableList(List *tables)
if (t->whereClause)
relids_with_rf = lappend_oid(relids_with_rf, childrelid);
- if (t->whereClause)
- relids_with_cf = lappend_oid(relids_with_cf, childrelid);
+ if (t->columns)
+ relids_with_collist = lappend_oid(relids_with_collist, childrelid);
}
}
}
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c
index 1d8d4af341..3e282ed99a 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -592,24 +592,24 @@ CheckCmdReplicaIdentity(Relation rel, CmdType cmd)
errmsg("cannot update table \"%s\"",
RelationGetRelationName(rel)),
errdetail("Column used in the publication WHERE expression is not part of the replica identity.")));
- else if (cmd == CMD_UPDATE && !pubdesc.cf_valid_for_update)
+ else if (cmd == CMD_UPDATE && !pubdesc.cols_valid_for_update)
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("cannot update table \"%s\"",
RelationGetRelationName(rel)),
- errdetail("Column filter used by the publication does not cover the replica identity.")));
+ errdetail("Column list used by the publication does not cover the replica identity.")));
else if (cmd == CMD_DELETE && !pubdesc.rf_valid_for_delete)
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("cannot delete from table \"%s\"",
RelationGetRelationName(rel)),
errdetail("Column used in the publication WHERE expression is not part of the replica identity.")));
- else if (cmd == CMD_DELETE && !pubdesc.cf_valid_for_delete)
+ else if (cmd == CMD_DELETE && !pubdesc.cols_valid_for_delete)
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("cannot delete from table \"%s\"",
RelationGetRelationName(rel)),
- errdetail("Column filter used by the publication does not cover the replica identity.")));
+ errdetail("Column list used by the publication does not cover the replica identity.")));
/* If relation has replica identity we are always good. */
if (OidIsValid(RelationGetReplicaIndex(rel)))
diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c
index 1e8785ff9a..816d461acd 100644
--- a/src/backend/replication/logical/proto.c
+++ b/src/backend/replication/logical/proto.c
@@ -40,8 +40,12 @@ static void logicalrep_read_tuple(StringInfo in, LogicalRepTupleData *tuple);
static void logicalrep_write_namespace(StringInfo out, Oid nspid);
static const char *logicalrep_read_namespace(StringInfo in);
-#define ColumnInFilter(columns, attnum) \
- (((columns) == NULL) || (bms_is_member((attnum), (columns))))
+
+static bool
+column_in_set(int attnum, Bitmapset *columns)
+{
+ return (columns == NULL || bms_is_member(attnum, columns));
+}
/*
@@ -774,9 +778,9 @@ logicalrep_write_tuple(StringInfo out, Relation rel, TupleTableSlot *slot,
if (att->attisdropped || att->attgenerated)
continue;
- /* skip columns not included in the column filter */
- if (!ColumnInFilter(columns, att->attnum))
+ if (!column_in_set(att->attnum, columns))
continue;
+
nliveatts++;
}
pq_sendint16(out, nliveatts);
@@ -795,8 +799,7 @@ logicalrep_write_tuple(StringInfo out, Relation rel, TupleTableSlot *slot,
if (att->attisdropped || att->attgenerated)
continue;
- /* skip columns not included in the column filter */
- if (!ColumnInFilter(columns, att->attnum))
+ if (!column_in_set(att->attnum, columns))
continue;
if (isnull[i])
@@ -938,8 +941,7 @@ logicalrep_write_attrs(StringInfo out, Relation rel, Bitmapset *columns)
if (att->attisdropped || att->attgenerated)
continue;
- /* skip columns not included in the column filter */
- if (!ColumnInFilter(columns, att->attnum))
+ if (!column_in_set(att->attnum, columns))
continue;
nliveatts++;
@@ -960,8 +962,7 @@ logicalrep_write_attrs(StringInfo out, Relation rel, Bitmapset *columns)
if (att->attisdropped || att->attgenerated)
continue;
- /* skip columns not included in the column filter */
- if (!ColumnInFilter(columns, att->attnum))
+ if (!column_in_set(att->attnum, columns))
continue;
/* REPLICA IDENTITY FULL means all columns are sent as part of key. */
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index 42708dcf82..d4d504fe02 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -754,13 +754,13 @@ fetch_remote_table_info(char *nspname, char *relname,
/*
- * Get relation's column filter expressions.
+ * Get column lists for each relation.
*
- * For initial synchronization, column filter can be ignored in following
+ * For initial synchronization, column lists can be ignored in following
* cases:
*
* 1) one of the subscribed publications for the table hasn't specified
- * any column filter
+ * any column list
*
* 2) one of the subscribed publications has puballtables set to true
*
@@ -788,7 +788,7 @@ fetch_remote_table_info(char *nspname, char *relname,
/*
* First, check if any of the publications FOR ALL TABLES? If yes, we
- * should not use any column filter. It's enough to find a single such
+ * should not use any column list. It's enough to find a single such
* publication.
*
* XXX Maybe we could combine all three steps into a single query, but
@@ -823,7 +823,7 @@ fetch_remote_table_info(char *nspname, char *relname,
/*
* If there's no FOR ALL TABLES publication, look for a FOR ALL TABLES
* IN SCHEMA publication, with schema of the remote relation. The logic
- * is the same - such publications have no column filters.
+ * is the same - such publications have no column lists.
*
* XXX Does this need any handling of partitions / publish_via_part_root?
*/
@@ -859,8 +859,8 @@ fetch_remote_table_info(char *nspname, char *relname,
/*
* If we haven't found any FOR ALL TABLES [IN SCHEMA] publications for
- * the table, we have to look for the column filters set for relations.
- * First, we check if there's a publication with no column filter for
+ * the table, we have to look for the column lists for relations.
+ * First, we check if there's a publication with no column list for
* the relation - which means all columns need to be replicated.
*/
if (!all_columns)
@@ -906,7 +906,7 @@ fetch_remote_table_info(char *nspname, char *relname,
}
/*
- * All that
+ * All that FIXME
*/
if (!all_columns)
{
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index 07cdfc1d8c..b4203788b0 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -1936,7 +1936,7 @@ get_rel_sync_entry(PGOutputData *data, Relation relation)
if (isnull)
{
/*
- * If we see a publication with no column filter, it
+ * If we see a publication with no column list, it
* means we need to publish all columns, so reset the
* list and ignore further ones.
*/
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 82e595396e..a2da72f0d4 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -5553,8 +5553,8 @@ RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
memset(pubdesc, 0, sizeof(PublicationDesc));
pubdesc->rf_valid_for_update = true;
pubdesc->rf_valid_for_delete = true;
- pubdesc->cf_valid_for_update = true;
- pubdesc->cf_valid_for_delete = true;
+ pubdesc->cols_valid_for_update = true;
+ pubdesc->cols_valid_for_delete = true;
return;
}
@@ -5567,8 +5567,8 @@ RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
memset(pubdesc, 0, sizeof(PublicationDesc));
pubdesc->rf_valid_for_update = true;
pubdesc->rf_valid_for_delete = true;
- pubdesc->cf_valid_for_update = true;
- pubdesc->cf_valid_for_delete = true;
+ pubdesc->cols_valid_for_update = true;
+ pubdesc->cols_valid_for_delete = true;
/* Fetch the publication membership info. */
puboids = GetRelationPublications(relid);
@@ -5620,7 +5620,7 @@ RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
*/
if (!pubform->puballtables &&
(pubform->pubupdate || pubform->pubdelete) &&
- contain_invalid_rfcolumn(pubid, relation, ancestors,
+ pub_rf_contains_invalid_column(pubid, relation, ancestors,
pubform->pubviaroot))
{
if (pubform->pubupdate)
@@ -5630,21 +5630,20 @@ RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
}
/*
- * Check if all columns referenced in the column filter are part of
- * the REPLICA IDENTITY index or not.
+ * Check if all columns are part of the REPLICA IDENTITY index or not.
*
* If the publication is FOR ALL TABLES then it means the table has no
- * column filters and we can skip the validation.
+ * column list and we can skip the validation.
*/
if (!pubform->puballtables &&
(pubform->pubupdate || pubform->pubdelete) &&
- contain_invalid_cfcolumn(pubid, relation, ancestors,
+ pub_collist_contains_invalid_column(pubid, relation, ancestors,
pubform->pubviaroot))
{
if (pubform->pubupdate)
- pubdesc->cf_valid_for_update = false;
+ pubdesc->cols_valid_for_update = false;
if (pubform->pubdelete)
- pubdesc->cf_valid_for_delete = false;
+ pubdesc->cols_valid_for_delete = false;
}
ReleaseSysCache(tup);
@@ -5660,13 +5659,13 @@ RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
break;
/*
- * If we know everything is replicated and the column filter is invalid
+ * If we know everything is replicated and the column list is invalid
* for update and delete, there is no point to check for other
* publications.
*/
if (pubdesc->pubactions.pubinsert && pubdesc->pubactions.pubupdate &&
pubdesc->pubactions.pubdelete && pubdesc->pubactions.pubtruncate &&
- !pubdesc->cf_valid_for_update && !pubdesc->cf_valid_for_delete)
+ !pubdesc->cols_valid_for_update && !pubdesc->cols_valid_for_delete)
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index fb18cb82d9..e462ccfb74 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2941,7 +2941,7 @@ describeOneTableDetails(const char *schemaname,
printfPQExpBuffer(&buf, " \"%s\"",
PQgetvalue(result, i, 0));
- /* column filter (if any) */
+ /* column list (if any) */
if (!PQgetisnull(result, i, 2))
appendPQExpBuffer(&buf, " (%s)",
PQgetvalue(result, i, 2));
diff --git a/src/include/catalog/pg_publication.h b/src/include/catalog/pg_publication.h
index b58f85ede2..a06742a620 100644
--- a/src/include/catalog/pg_publication.h
+++ b/src/include/catalog/pg_publication.h
@@ -87,12 +87,11 @@ typedef struct PublicationDesc
bool rf_valid_for_delete;
/*
- * true if the columns referenced in column filters which are used for UPDATE
- * or DELETE are part of the replica identity or the publication actions
+ * true if the columns are part of the replica identity or the publication actions
* do not include UPDATE or DELETE.
*/
- bool cf_valid_for_update;
- bool cf_valid_for_delete;
+ bool cols_valid_for_update;
+ bool cols_valid_for_delete;
} PublicationDesc;
typedef struct Publication
diff --git a/src/include/commands/publicationcmds.h b/src/include/commands/publicationcmds.h
index 08d14ca724..ae87caf089 100644
--- a/src/include/commands/publicationcmds.h
+++ b/src/include/commands/publicationcmds.h
@@ -31,9 +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 contain_invalid_cfcolumn(Oid pubid, Relation relation,
+extern bool pub_collist_contains_invalid_column(Oid pubid, Relation relation,
List *ancestors, bool pubviaroot);
#endif /* PUBLICATIONCMDS_H */
diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out
index 152f19fb42..80202f84ff 100644
--- a/src/test/regress/expected/publication.out
+++ b/src/test/regress/expected/publication.out
@@ -679,14 +679,14 @@ DROP TABLE rf_tbl_abcd_pk;
DROP TABLE rf_tbl_abcd_nopk;
DROP TABLE rf_tbl_abcd_part_pk;
-- ======================================================
--- fail - duplicate tables are not allowed if that table has any column filters
+-- fail - duplicate tables are not allowed if that table has any column lists
SET client_min_messages = 'ERROR';
CREATE PUBLICATION testpub_dups FOR TABLE testpub_tbl1 (a), testpub_tbl1 WITH (publish = 'insert');
-ERROR: conflicting or redundant column filters for table "testpub_tbl1"
+ERROR: conflicting or redundant column lists for table "testpub_tbl1"
CREATE PUBLICATION testpub_dups FOR TABLE testpub_tbl1, testpub_tbl1 (a) WITH (publish = 'insert');
-ERROR: conflicting or redundant column filters for table "testpub_tbl1"
+ERROR: conflicting or redundant column lists for table "testpub_tbl1"
RESET client_min_messages;
--- test for column filters
+-- test for column lists
SET client_min_messages = 'ERROR';
CREATE PUBLICATION testpub_fortable FOR TABLE testpub_tbl1;
CREATE PUBLICATION testpub_fortable_insert WITH (publish = 'insert');
@@ -696,16 +696,16 @@ CREATE TABLE testpub_tbl5 (a int PRIMARY KEY, b text, c text,
-- error: column "x" does not exist
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, x);
ERROR: column "x" of relation "testpub_tbl5" does not exist
--- error: replica identity "a" not included in the column filter
+-- error: replica identity "a" not included in the column list
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (b, c);
UPDATE testpub_tbl5 SET a = 1;
ERROR: cannot update table "testpub_tbl5"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
ALTER PUBLICATION testpub_fortable DROP TABLE testpub_tbl5;
-- error: generated column "d" can't be in list
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, d);
ERROR: cannot reference generated column "d" in publication column list
--- error: system attributes "ctid" not allowed in column filter
+-- error: system attributes "ctid" not allowed in column list
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, ctid);
ERROR: cannot reference system column "ctid" in publication column list
-- ok
@@ -713,24 +713,24 @@ ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, c);
ALTER TABLE testpub_tbl5 DROP COLUMN c; -- no dice
ERROR: cannot drop column "c" because it is part of publication "testpub_fortable"
HINT: Specify CASCADE or use ALTER PUBLICATION to remove the column from the publication.
--- ok: for insert-only publication, the filter is arbitrary
+-- ok: for insert-only publication, the column list is arbitrary
ALTER PUBLICATION testpub_fortable_insert ADD TABLE testpub_tbl5 (b, c);
/* not all replica identities are good enough */
CREATE UNIQUE INDEX testpub_tbl5_b_key ON testpub_tbl5 (b, c);
ALTER TABLE testpub_tbl5 ALTER b SET NOT NULL, ALTER c SET NOT NULL;
ALTER TABLE testpub_tbl5 REPLICA IDENTITY USING INDEX testpub_tbl5_b_key;
--- error: replica identity (b,c) is covered by column filter (a, c)
+-- error: replica identity (b,c) is covered by column list (a, c)
UPDATE testpub_tbl5 SET a = 1;
ERROR: cannot update table "testpub_tbl5"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
ALTER PUBLICATION testpub_fortable DROP TABLE testpub_tbl5;
--- error: change the replica identity to "b", and then filter (a, c) fails
+-- error: change the replica identity to "b", and then column list (a, c) fails
ALTER TABLE testpub_tbl5 REPLICA IDENTITY USING INDEX testpub_tbl5_b_key;
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, c);
--- error: replica identity (b,c) is not covered by column filter (a,c)
+-- error: replica identity (b,c) is not covered by column list (a, c)
UPDATE testpub_tbl5 SET a = 1;
ERROR: cannot update table "testpub_tbl5"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
/* But if upd/del are not published, it works OK */
SET client_min_messages = 'ERROR';
CREATE PUBLICATION testpub_table_ins WITH (publish = 'insert, truncate');
@@ -744,21 +744,21 @@ ALTER PUBLICATION testpub_table_ins ADD TABLE testpub_tbl5 (a); -- ok
Tables:
"public.testpub_tbl5" (a)
--- with REPLICA IDENTITY FULL, column filters are not allowed
+-- with REPLICA IDENTITY FULL, column lists are not allowed
CREATE TABLE testpub_tbl6 (a int, b text, c text);
ALTER TABLE testpub_tbl6 REPLICA IDENTITY FULL;
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl6 (a, b, c);
UPDATE testpub_tbl6 SET a = 1;
ERROR: cannot update table "testpub_tbl6"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
ALTER PUBLICATION testpub_fortable DROP TABLE testpub_tbl6;
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl6; -- ok
UPDATE testpub_tbl6 SET a = 1;
ALTER PUBLICATION testpub_fortable ALTER TABLE testpub_tbl6 SET COLUMNS (a, b, c);
UPDATE testpub_tbl6 SET a = 1;
ERROR: cannot update table "testpub_tbl6"
-DETAIL: Column filter used by the publication does not cover the replica identity.
--- make sure changing the column filter is updated in SET TABLE
+DETAIL: Column list used by the publication does not cover the replica identity.
+-- make sure changing the column list is updated in SET TABLE
CREATE TABLE testpub_tbl7 (a int primary key, b text, c text);
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl7 (a, b);
\d+ testpub_tbl7
@@ -787,7 +787,7 @@ Indexes:
Publications:
"testpub_fortable" (a, b)
--- ok: update the column filter
+-- ok: update the column list
ALTER PUBLICATION testpub_fortable SET TABLE testpub_tbl7 (a, c);
\d+ testpub_tbl7
Table "public.testpub_tbl7"
@@ -801,7 +801,7 @@ Indexes:
Publications:
"testpub_fortable" (a, c)
--- column filter for partitioned tables has to cover replica identities for
+-- column list for partitioned tables has to cover replica identities for
-- all child relations
CREATE TABLE testpub_tbl8 (a int, b text, c text) PARTITION BY HASH (a);
-- first partition has replica identity "a"
@@ -812,48 +812,48 @@ ALTER TABLE testpub_tbl8_0 REPLICA IDENTITY USING INDEX testpub_tbl8_0_pkey;
CREATE TABLE testpub_tbl8_1 PARTITION OF testpub_tbl8 FOR VALUES WITH (modulus 2, remainder 1);
ALTER TABLE testpub_tbl8_1 ADD PRIMARY KEY (b);
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY USING INDEX testpub_tbl8_1_pkey;
--- ok: column filter covers both "a" and "b"
+-- ok: column list covers both "a" and "b"
SET client_min_messages = 'ERROR';
-CREATE PUBLICATION testpub_col_filter FOR TABLE testpub_tbl8 (a, b) WITH (publish_via_partition_root = 'true');
+CREATE PUBLICATION testpub_col_list FOR TABLE testpub_tbl8 (a, b) WITH (publish_via_partition_root = 'true');
RESET client_min_messages;
-- ok: the same thing, but try plain ADD TABLE
-ALTER PUBLICATION testpub_col_filter DROP TABLE testpub_tbl8;
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, b);
+ALTER PUBLICATION testpub_col_list DROP TABLE testpub_tbl8;
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, b);
UPDATE testpub_tbl8 SET a = 1;
--- failure: column filter does not cover replica identity for the second partition
-ALTER PUBLICATION testpub_col_filter DROP TABLE testpub_tbl8;
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, c);
+-- failure: column list does not cover replica identity for the second partition
+ALTER PUBLICATION testpub_col_list DROP TABLE testpub_tbl8;
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, c);
UPDATE testpub_tbl8 SET a = 1;
ERROR: cannot update table "testpub_tbl8_1"
-DETAIL: Column filter used by the publication does not cover the replica identity.
-ALTER PUBLICATION testpub_col_filter DROP TABLE testpub_tbl8;
+DETAIL: Column list used by the publication does not cover the replica identity.
+ALTER PUBLICATION testpub_col_list DROP TABLE testpub_tbl8;
-- failure: one of the partitions has REPLICA IDENTITY FULL
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY FULL;
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, c);
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, c);
UPDATE testpub_tbl8 SET a = 1;
ERROR: cannot update table "testpub_tbl8_1"
-DETAIL: Column filter used by the publication does not cover the replica identity.
-ALTER PUBLICATION testpub_col_filter DROP TABLE testpub_tbl8;
+DETAIL: Column list used by the publication does not cover the replica identity.
+ALTER PUBLICATION testpub_col_list DROP TABLE testpub_tbl8;
-- add table and then try changing replica identity
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY USING INDEX testpub_tbl8_1_pkey;
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, b);
--- failure: replica identity full can't be used with a column filter
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, b);
+-- failure: replica identity full can't be used with a column list
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY FULL;
UPDATE testpub_tbl8 SET a = 1;
ERROR: cannot update table "testpub_tbl8_1"
-DETAIL: Column filter used by the publication does not cover the replica identity.
--- failure: replica identity has to be covered by the column filter
+DETAIL: Column list used by the publication does not cover the replica identity.
+-- failure: replica identity has to be covered by the column list
ALTER TABLE testpub_tbl8_1 DROP CONSTRAINT testpub_tbl8_1_pkey;
ALTER TABLE testpub_tbl8_1 ADD PRIMARY KEY (c);
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY USING INDEX testpub_tbl8_1_pkey;
UPDATE testpub_tbl8 SET a = 1;
ERROR: cannot update table "testpub_tbl8_1"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
DROP TABLE testpub_tbl8;
--- column filter for partitioned tables has to cover replica identities for
+-- column list for partitioned tables has to cover replica identities for
-- all child relations
CREATE TABLE testpub_tbl8 (a int, b text, c text) PARTITION BY HASH (a);
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, b);
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, b);
-- first partition has replica identity "a"
CREATE TABLE testpub_tbl8_0 (a int, b text, c text);
ALTER TABLE testpub_tbl8_0 ADD PRIMARY KEY (a);
@@ -862,23 +862,23 @@ ALTER TABLE testpub_tbl8_0 REPLICA IDENTITY USING INDEX testpub_tbl8_0_pkey;
CREATE TABLE testpub_tbl8_1 (a int, b text, c text);
ALTER TABLE testpub_tbl8_1 ADD PRIMARY KEY (c);
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY USING INDEX testpub_tbl8_1_pkey;
--- ok: attaching first partition works, because (a) is in column filter
+-- ok: attaching first partition works, because (a) is in column list
ALTER TABLE testpub_tbl8 ATTACH PARTITION testpub_tbl8_0 FOR VALUES WITH (modulus 2, remainder 0);
--- failure: second partition has replica identity (c), which si not in column filter
+-- failure: second partition has replica identity (c), which si not in column list
ALTER TABLE testpub_tbl8 ATTACH PARTITION testpub_tbl8_1 FOR VALUES WITH (modulus 2, remainder 1);
UPDATE testpub_tbl8 SET a = 1;
ERROR: cannot update table "testpub_tbl8_1"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
-- failure: changing replica identity to FULL for partition fails, because
--- of the column filter on the parent
+-- of the column list on the parent
ALTER TABLE testpub_tbl8_0 REPLICA IDENTITY FULL;
UPDATE testpub_tbl8 SET a = 1;
ERROR: cannot update table "testpub_tbl8_0"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
DROP TABLE testpub_tbl5, testpub_tbl6, testpub_tbl7, testpub_tbl8, testpub_tbl8_1;
-DROP PUBLICATION testpub_table_ins, testpub_fortable, testpub_fortable_insert, testpub_col_filter;
+DROP PUBLICATION testpub_table_ins, testpub_fortable, testpub_fortable_insert, testpub_col_list;
-- ======================================================
--- Test combination of column and row filter
+-- Test combination of column list and row filter
SET client_min_messages = 'ERROR';
CREATE PUBLICATION testpub_both_filters;
RESET client_min_messages;
@@ -908,7 +908,7 @@ Publications:
DROP TABLE testpub_tbl_both_filters;
DROP PUBLICATION testpub_both_filters;
-- ======================================================
--- More column filter tests for validating column references
+-- More column list tests for validating column references
CREATE TABLE rf_tbl_abcd_nopk(a int, b int, c int, d int);
CREATE TABLE rf_tbl_abcd_pk(a int, b int, c int, d int, PRIMARY KEY(a,b));
CREATE TABLE rf_tbl_abcd_part_pk (a int PRIMARY KEY, b int) PARTITION by RANGE (a);
@@ -925,18 +925,18 @@ ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (a, b, c);
-- ok - (a,b,c) coverts all PK cols
UPDATE rf_tbl_abcd_pk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (a);
--- fail - "b" is missing from the column filter
+-- fail - "b" is missing from the column list
UPDATE rf_tbl_abcd_pk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_pk"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (b);
--- fail - "a" is missing from the column filter
+-- fail - "a" is missing from the column list
UPDATE rf_tbl_abcd_pk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_pk"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
-- 1b. REPLICA IDENTITY is DEFAULT and table has no PK
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (a);
--- ok - there's no replica identity, so any column filter works
+-- ok - there's no replica identity, so any column list works
-- note: it fails anyway, just a bit later because UPDATE requires RI
UPDATE rf_tbl_abcd_nopk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_nopk" because it does not have a replica identity and publishes updates
@@ -945,32 +945,32 @@ HINT: To enable updating the table, set REPLICA IDENTITY using ALTER TABLE.
ALTER TABLE rf_tbl_abcd_pk REPLICA IDENTITY FULL;
ALTER TABLE rf_tbl_abcd_nopk REPLICA IDENTITY FULL;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (c);
--- fail - with REPLICA IDENTITY FULL no column filter is allowed
+-- fail - with REPLICA IDENTITY FULL no column list is allowed
UPDATE rf_tbl_abcd_pk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_pk"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (a, b, c, d);
--- fail - with REPLICA IDENTITY FULL no column filter is allowed
+-- fail - with REPLICA IDENTITY FULL no column list is allowed
UPDATE rf_tbl_abcd_nopk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_nopk"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
-- Case 3. REPLICA IDENTITY NOTHING
ALTER TABLE rf_tbl_abcd_pk REPLICA IDENTITY NOTHING;
ALTER TABLE rf_tbl_abcd_nopk REPLICA IDENTITY NOTHING;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (a);
--- ok - REPLICA IDENTITY NOTHING means all column filters are valid
+-- ok - REPLICA IDENTITY NOTHING means all column lists are valid
-- it still fails later because without RI we can't replicate updates
UPDATE rf_tbl_abcd_pk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_pk" because it does not have a replica identity and publishes updates
HINT: To enable updating the table, set REPLICA IDENTITY using ALTER TABLE.
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (a, b, c, d);
--- ok - REPLICA IDENTITY NOTHING means all column filters are valid
+-- ok - REPLICA IDENTITY NOTHING means all column lists are valid
-- it still fails later because without RI we can't replicate updates
UPDATE rf_tbl_abcd_pk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_pk" because it does not have a replica identity and publishes updates
HINT: To enable updating the table, set REPLICA IDENTITY using ALTER TABLE.
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (d);
--- ok - REPLICA IDENTITY NOTHING means all column filters are valid
+-- ok - REPLICA IDENTITY NOTHING means all column lists are valid
-- it still fails later because without RI we can't replicate updates
UPDATE rf_tbl_abcd_nopk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_nopk" because it does not have a replica identity and publishes updates
@@ -983,20 +983,20 @@ ALTER TABLE rf_tbl_abcd_nopk ALTER COLUMN c SET NOT NULL;
CREATE UNIQUE INDEX idx_abcd_nopk_c ON rf_tbl_abcd_nopk(c);
ALTER TABLE rf_tbl_abcd_nopk REPLICA IDENTITY USING INDEX idx_abcd_nopk_c;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (a);
--- fail - column filter "a" does not cover the REPLICA IDENTITY INDEX on "c"
+-- fail - column list "a" does not cover the REPLICA IDENTITY INDEX on "c"
UPDATE rf_tbl_abcd_pk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_pk"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (c);
--- ok - column filter "c" does cover the REPLICA IDENTITY INDEX on "c"
+-- ok - column list "c" does cover the REPLICA IDENTITY INDEX on "c"
UPDATE rf_tbl_abcd_pk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (a);
--- fail - column filter "a" does not cover the REPLICA IDENTITY INDEX on "c"
+-- fail - column list "a" does not cover the REPLICA IDENTITY INDEX on "c"
UPDATE rf_tbl_abcd_nopk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_nopk"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (c);
--- ok - column filter "c" does cover the REPLICA IDENTITY INDEX on "c"
+-- ok - column list "c" does cover the REPLICA IDENTITY INDEX on "c"
UPDATE rf_tbl_abcd_nopk SET a = 1;
-- Tests for partitioned table
-- set PUBLISH_VIA_PARTITION_ROOT to false and test row filter for partitioned
@@ -1021,7 +1021,7 @@ UPDATE rf_tbl_abcd_part_pk SET a = 1;
-- used for partitioned table
ALTER PUBLICATION testpub6 SET (PUBLISH_VIA_PARTITION_ROOT=0);
ERROR: cannot set publish_via_partition_root = false for publication "testpub6"
-DETAIL: The publication contains a column filter for a partitioned table "rf_tbl_abcd_part_pk" which is not allowed when publish_via_partition_root is false.
+DETAIL: The publication contains a column list for a partitioned table "rf_tbl_abcd_part_pk" which is not allowed when publish_via_partition_root is false.
-- Now change the root filter to use a column "b"
-- (which is not in the replica identity)
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_part_pk_1 (b);
@@ -1030,7 +1030,7 @@ ALTER PUBLICATION testpub6 SET (PUBLISH_VIA_PARTITION_ROOT=0);
-- fail - "b" is not in REPLICA IDENTITY INDEX
UPDATE rf_tbl_abcd_part_pk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_part_pk_1"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
-- set PUBLISH_VIA_PARTITION_ROOT to true
-- can use row filter for partitioned table
ALTER PUBLICATION testpub6 SET (PUBLISH_VIA_PARTITION_ROOT=1);
@@ -1039,7 +1039,7 @@ ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_part_pk (b);
-- fail - "b" is not in REPLICA IDENTITY INDEX
UPDATE rf_tbl_abcd_part_pk SET a = 1;
ERROR: cannot update table "rf_tbl_abcd_part_pk_1"
-DETAIL: Column filter used by the publication does not cover the replica identity.
+DETAIL: Column list used by the publication does not cover the replica identity.
DROP PUBLICATION testpub6;
DROP TABLE rf_tbl_abcd_pk;
DROP TABLE rf_tbl_abcd_nopk;
diff --git a/src/test/regress/sql/publication.sql b/src/test/regress/sql/publication.sql
index 2203dc238d..32a810b2d2 100644
--- a/src/test/regress/sql/publication.sql
+++ b/src/test/regress/sql/publication.sql
@@ -381,13 +381,13 @@ CREATE UNIQUE INDEX idx_abcd_nopk_c ON rf_tbl_abcd_nopk(c);
DROP TABLE rf_tbl_abcd_part_pk;
-- ======================================================
--- fail - duplicate tables are not allowed if that table has any column filters
+-- fail - duplicate tables are not allowed if that table has any column lists
SET client_min_messages = 'ERROR';
CREATE PUBLICATION testpub_dups FOR TABLE testpub_tbl1 (a), testpub_tbl1 WITH (publish = 'insert');
CREATE PUBLICATION testpub_dups FOR TABLE testpub_tbl1, testpub_tbl1 (a) WITH (publish = 'insert');
RESET client_min_messages;
--- test for column filters
+-- test for column lists
SET client_min_messages = 'ERROR';
CREATE PUBLICATION testpub_fortable FOR TABLE testpub_tbl1;
CREATE PUBLICATION testpub_fortable_insert WITH (publish = 'insert');
@@ -396,32 +396,32 @@ CREATE TABLE testpub_tbl5 (a int PRIMARY KEY, b text, c text,
d int generated always as (a + length(b)) stored);
-- error: column "x" does not exist
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, x);
--- error: replica identity "a" not included in the column filter
+-- error: replica identity "a" not included in the column list
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (b, c);
UPDATE testpub_tbl5 SET a = 1;
ALTER PUBLICATION testpub_fortable DROP TABLE testpub_tbl5;
-- error: generated column "d" can't be in list
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, d);
--- error: system attributes "ctid" not allowed in column filter
+-- error: system attributes "ctid" not allowed in column list
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, ctid);
-- ok
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, c);
ALTER TABLE testpub_tbl5 DROP COLUMN c; -- no dice
--- ok: for insert-only publication, the filter is arbitrary
+-- ok: for insert-only publication, the column list is arbitrary
ALTER PUBLICATION testpub_fortable_insert ADD TABLE testpub_tbl5 (b, c);
/* not all replica identities are good enough */
CREATE UNIQUE INDEX testpub_tbl5_b_key ON testpub_tbl5 (b, c);
ALTER TABLE testpub_tbl5 ALTER b SET NOT NULL, ALTER c SET NOT NULL;
ALTER TABLE testpub_tbl5 REPLICA IDENTITY USING INDEX testpub_tbl5_b_key;
--- error: replica identity (b,c) is covered by column filter (a, c)
+-- error: replica identity (b,c) is covered by column list (a, c)
UPDATE testpub_tbl5 SET a = 1;
ALTER PUBLICATION testpub_fortable DROP TABLE testpub_tbl5;
--- error: change the replica identity to "b", and then filter (a, c) fails
+-- error: change the replica identity to "b", and then column list (a, c) fails
ALTER TABLE testpub_tbl5 REPLICA IDENTITY USING INDEX testpub_tbl5_b_key;
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl5 (a, c);
--- error: replica identity (b,c) is not covered by column filter (a,c)
+-- error: replica identity (b,c) is not covered by column list (a, c)
UPDATE testpub_tbl5 SET a = 1;
/* But if upd/del are not published, it works OK */
@@ -431,7 +431,7 @@ CREATE PUBLICATION testpub_table_ins WITH (publish = 'insert, truncate');
ALTER PUBLICATION testpub_table_ins ADD TABLE testpub_tbl5 (a); -- ok
\dRp+ testpub_table_ins
--- with REPLICA IDENTITY FULL, column filters are not allowed
+-- with REPLICA IDENTITY FULL, column lists are not allowed
CREATE TABLE testpub_tbl6 (a int, b text, c text);
ALTER TABLE testpub_tbl6 REPLICA IDENTITY FULL;
@@ -445,18 +445,18 @@ CREATE TABLE testpub_tbl6 (a int, b text, c text);
ALTER PUBLICATION testpub_fortable ALTER TABLE testpub_tbl6 SET COLUMNS (a, b, c);
UPDATE testpub_tbl6 SET a = 1;
--- make sure changing the column filter is updated in SET TABLE
+-- make sure changing the column list is updated in SET TABLE
CREATE TABLE testpub_tbl7 (a int primary key, b text, c text);
ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl7 (a, b);
\d+ testpub_tbl7
-- ok: we'll skip this table
ALTER PUBLICATION testpub_fortable SET TABLE testpub_tbl7 (a, b);
\d+ testpub_tbl7
--- ok: update the column filter
+-- ok: update the column list
ALTER PUBLICATION testpub_fortable SET TABLE testpub_tbl7 (a, c);
\d+ testpub_tbl7
--- column filter for partitioned tables has to cover replica identities for
+-- column list for partitioned tables has to cover replica identities for
-- all child relations
CREATE TABLE testpub_tbl8 (a int, b text, c text) PARTITION BY HASH (a);
-- first partition has replica identity "a"
@@ -468,37 +468,37 @@ CREATE TABLE testpub_tbl8_1 PARTITION OF testpub_tbl8 FOR VALUES WITH (modulus 2
ALTER TABLE testpub_tbl8_1 ADD PRIMARY KEY (b);
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY USING INDEX testpub_tbl8_1_pkey;
--- ok: column filter covers both "a" and "b"
+-- ok: column list covers both "a" and "b"
SET client_min_messages = 'ERROR';
-CREATE PUBLICATION testpub_col_filter FOR TABLE testpub_tbl8 (a, b) WITH (publish_via_partition_root = 'true');
+CREATE PUBLICATION testpub_col_list FOR TABLE testpub_tbl8 (a, b) WITH (publish_via_partition_root = 'true');
RESET client_min_messages;
-- ok: the same thing, but try plain ADD TABLE
-ALTER PUBLICATION testpub_col_filter DROP TABLE testpub_tbl8;
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, b);
+ALTER PUBLICATION testpub_col_list DROP TABLE testpub_tbl8;
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, b);
UPDATE testpub_tbl8 SET a = 1;
--- failure: column filter does not cover replica identity for the second partition
-ALTER PUBLICATION testpub_col_filter DROP TABLE testpub_tbl8;
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, c);
+-- failure: column list does not cover replica identity for the second partition
+ALTER PUBLICATION testpub_col_list DROP TABLE testpub_tbl8;
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, c);
UPDATE testpub_tbl8 SET a = 1;
-ALTER PUBLICATION testpub_col_filter DROP TABLE testpub_tbl8;
+ALTER PUBLICATION testpub_col_list DROP TABLE testpub_tbl8;
-- failure: one of the partitions has REPLICA IDENTITY FULL
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY FULL;
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, c);
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, c);
UPDATE testpub_tbl8 SET a = 1;
-ALTER PUBLICATION testpub_col_filter DROP TABLE testpub_tbl8;
+ALTER PUBLICATION testpub_col_list DROP TABLE testpub_tbl8;
-- add table and then try changing replica identity
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY USING INDEX testpub_tbl8_1_pkey;
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, b);
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, b);
--- failure: replica identity full can't be used with a column filter
+-- failure: replica identity full can't be used with a column list
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY FULL;
UPDATE testpub_tbl8 SET a = 1;
--- failure: replica identity has to be covered by the column filter
+-- failure: replica identity has to be covered by the column list
ALTER TABLE testpub_tbl8_1 DROP CONSTRAINT testpub_tbl8_1_pkey;
ALTER TABLE testpub_tbl8_1 ADD PRIMARY KEY (c);
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY USING INDEX testpub_tbl8_1_pkey;
@@ -506,10 +506,10 @@ CREATE PUBLICATION testpub_col_filter FOR TABLE testpub_tbl8 (a, b) WITH (publis
DROP TABLE testpub_tbl8;
--- column filter for partitioned tables has to cover replica identities for
+-- column list for partitioned tables has to cover replica identities for
-- all child relations
CREATE TABLE testpub_tbl8 (a int, b text, c text) PARTITION BY HASH (a);
-ALTER PUBLICATION testpub_col_filter ADD TABLE testpub_tbl8 (a, b);
+ALTER PUBLICATION testpub_col_list ADD TABLE testpub_tbl8 (a, b);
-- first partition has replica identity "a"
CREATE TABLE testpub_tbl8_0 (a int, b text, c text);
ALTER TABLE testpub_tbl8_0 ADD PRIMARY KEY (a);
@@ -519,22 +519,22 @@ CREATE TABLE testpub_tbl8_1 (a int, b text, c text);
ALTER TABLE testpub_tbl8_1 ADD PRIMARY KEY (c);
ALTER TABLE testpub_tbl8_1 REPLICA IDENTITY USING INDEX testpub_tbl8_1_pkey;
--- ok: attaching first partition works, because (a) is in column filter
+-- ok: attaching first partition works, because (a) is in column list
ALTER TABLE testpub_tbl8 ATTACH PARTITION testpub_tbl8_0 FOR VALUES WITH (modulus 2, remainder 0);
--- failure: second partition has replica identity (c), which si not in column filter
+-- failure: second partition has replica identity (c), which si not in column list
ALTER TABLE testpub_tbl8 ATTACH PARTITION testpub_tbl8_1 FOR VALUES WITH (modulus 2, remainder 1);
UPDATE testpub_tbl8 SET a = 1;
-- failure: changing replica identity to FULL for partition fails, because
--- of the column filter on the parent
+-- of the column list on the parent
ALTER TABLE testpub_tbl8_0 REPLICA IDENTITY FULL;
UPDATE testpub_tbl8 SET a = 1;
DROP TABLE testpub_tbl5, testpub_tbl6, testpub_tbl7, testpub_tbl8, testpub_tbl8_1;
-DROP PUBLICATION testpub_table_ins, testpub_fortable, testpub_fortable_insert, testpub_col_filter;
+DROP PUBLICATION testpub_table_ins, testpub_fortable, testpub_fortable_insert, testpub_col_list;
-- ======================================================
--- Test combination of column and row filter
+-- Test combination of column list and row filter
SET client_min_messages = 'ERROR';
CREATE PUBLICATION testpub_both_filters;
RESET client_min_messages;
@@ -548,7 +548,7 @@ CREATE TABLE testpub_tbl_both_filters (a int, b int, c int, PRIMARY KEY (a,c));
DROP PUBLICATION testpub_both_filters;
-- ======================================================
--- More column filter tests for validating column references
+-- More column list tests for validating column references
CREATE TABLE rf_tbl_abcd_nopk(a int, b int, c int, d int);
CREATE TABLE rf_tbl_abcd_pk(a int, b int, c int, d int, PRIMARY KEY(a,b));
CREATE TABLE rf_tbl_abcd_part_pk (a int PRIMARY KEY, b int) PARTITION by RANGE (a);
@@ -567,15 +567,15 @@ CREATE PUBLICATION testpub6 FOR TABLE rf_tbl_abcd_pk (a, b);
-- ok - (a,b,c) coverts all PK cols
UPDATE rf_tbl_abcd_pk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (a);
--- fail - "b" is missing from the column filter
+-- fail - "b" is missing from the column list
UPDATE rf_tbl_abcd_pk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (b);
--- fail - "a" is missing from the column filter
+-- fail - "a" is missing from the column list
UPDATE rf_tbl_abcd_pk SET a = 1;
-- 1b. REPLICA IDENTITY is DEFAULT and table has no PK
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (a);
--- ok - there's no replica identity, so any column filter works
+-- ok - there's no replica identity, so any column list works
-- note: it fails anyway, just a bit later because UPDATE requires RI
UPDATE rf_tbl_abcd_nopk SET a = 1;
@@ -583,25 +583,25 @@ CREATE PUBLICATION testpub6 FOR TABLE rf_tbl_abcd_pk (a, b);
ALTER TABLE rf_tbl_abcd_pk REPLICA IDENTITY FULL;
ALTER TABLE rf_tbl_abcd_nopk REPLICA IDENTITY FULL;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (c);
--- fail - with REPLICA IDENTITY FULL no column filter is allowed
+-- fail - with REPLICA IDENTITY FULL no column list is allowed
UPDATE rf_tbl_abcd_pk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (a, b, c, d);
--- fail - with REPLICA IDENTITY FULL no column filter is allowed
+-- fail - with REPLICA IDENTITY FULL no column list is allowed
UPDATE rf_tbl_abcd_nopk SET a = 1;
-- Case 3. REPLICA IDENTITY NOTHING
ALTER TABLE rf_tbl_abcd_pk REPLICA IDENTITY NOTHING;
ALTER TABLE rf_tbl_abcd_nopk REPLICA IDENTITY NOTHING;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (a);
--- ok - REPLICA IDENTITY NOTHING means all column filters are valid
+-- ok - REPLICA IDENTITY NOTHING means all column lists are valid
-- it still fails later because without RI we can't replicate updates
UPDATE rf_tbl_abcd_pk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (a, b, c, d);
--- ok - REPLICA IDENTITY NOTHING means all column filters are valid
+-- ok - REPLICA IDENTITY NOTHING means all column lists are valid
-- it still fails later because without RI we can't replicate updates
UPDATE rf_tbl_abcd_pk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (d);
--- ok - REPLICA IDENTITY NOTHING means all column filters are valid
+-- ok - REPLICA IDENTITY NOTHING means all column lists are valid
-- it still fails later because without RI we can't replicate updates
UPDATE rf_tbl_abcd_nopk SET a = 1;
@@ -613,16 +613,16 @@ CREATE UNIQUE INDEX idx_abcd_pk_c ON rf_tbl_abcd_pk(c);
CREATE UNIQUE INDEX idx_abcd_nopk_c ON rf_tbl_abcd_nopk(c);
ALTER TABLE rf_tbl_abcd_nopk REPLICA IDENTITY USING INDEX idx_abcd_nopk_c;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (a);
--- fail - column filter "a" does not cover the REPLICA IDENTITY INDEX on "c"
+-- fail - column list "a" does not cover the REPLICA IDENTITY INDEX on "c"
UPDATE rf_tbl_abcd_pk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_pk (c);
--- ok - column filter "c" does cover the REPLICA IDENTITY INDEX on "c"
+-- ok - column list "c" does cover the REPLICA IDENTITY INDEX on "c"
UPDATE rf_tbl_abcd_pk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (a);
--- fail - column filter "a" does not cover the REPLICA IDENTITY INDEX on "c"
+-- fail - column list "a" does not cover the REPLICA IDENTITY INDEX on "c"
UPDATE rf_tbl_abcd_nopk SET a = 1;
ALTER PUBLICATION testpub6 SET TABLE rf_tbl_abcd_nopk (c);
--- ok - column filter "c" does cover the REPLICA IDENTITY INDEX on "c"
+-- ok - column list "c" does cover the REPLICA IDENTITY INDEX on "c"
UPDATE rf_tbl_abcd_nopk SET a = 1;
-- Tests for partitioned table
diff --git a/src/test/subscription/t/029_column_list.pl b/src/test/subscription/t/029_column_list.pl
index ec2c8a789a..e5ab5d5731 100644
--- a/src/test/subscription/t/029_column_list.pl
+++ b/src/test/subscription/t/029_column_list.pl
@@ -5,7 +5,7 @@
use warnings;
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
-use Test::More tests => 26;
+use Test::More;
# setup
@@ -290,8 +290,8 @@ sub wait_for_subscription_sync
2|22|2222),
'overlapping publications with overlapping column lists');
-# and finally, set the column filter to ALL for one of the publications,
-# which means replicating all columns (removing the column filter), but
+# and finally, set the column list to ALL for one of the publications,
+# which means replicating all columns (removing the column list), but
# first add the missing column to the table on subscriber
$node_publisher->safe_psql('postgres', qq(
ALTER PUBLICATION pub3 ALTER TABLE tab5 SET COLUMNS ALL;
@@ -314,9 +314,9 @@ sub wait_for_subscription_sync
3|33|3333|333),
'overlapping publications with overlapping column lists');
-# TEST: create a table with a column filter, then change the replica
+# TEST: create a table with a column list, then change the replica
# identity by replacing a primary key (but use a different column in
-# the column filter)
+# the column list)
$node_publisher->safe_psql('postgres', qq(
CREATE TABLE tab6 (a int PRIMARY KEY, b int, c int, d int);
CREATE PUBLICATION pub4 FOR TABLE tab6 (a, b);
@@ -377,9 +377,9 @@ sub wait_for_subscription_sync
'replication with the modified primary key');
-# TEST: create a table with a column filter, then change the replica
+# TEST: create a table with a column list, then change the replica
# identity by replacing a primary key with a key on multiple columns
-# (all of them covered by the column filter)
+# (all of them covered by the column list)
$node_publisher->safe_psql('postgres', qq(
CREATE TABLE tab7 (a int PRIMARY KEY, b int, c int, d int);
CREATE PUBLICATION pub5 FOR TABLE tab7 (a, b);
@@ -425,7 +425,7 @@ sub wait_for_subscription_sync
'replication with the modified primary key');
# now switch the primary key again to another columns not covered by the
-# column filter, but also generate writes between the drop and creation
+# column list, but also generate writes between the drop and creation
# of the new constraint
$node_publisher->safe_psql('postgres', qq(
@@ -450,11 +450,11 @@ sub wait_for_subscription_sync
# TEST: partitioned tables (with publish_via_partition_root = false)
# and replica identity. The (leaf) partitions may have different RI, so
-# we need to check the partition RI (with respect to the column filter)
+# we need to check the partition RI (with respect to the column list)
# while attaching the partition.
# First, let's create a partitioned table with two partitions, each with
-# a different RI, but a column filter not covering all those RI.
+# a different RI, but a column list not covering all those RI.
$node_publisher->safe_psql('postgres', qq(
CREATE TABLE test_part_a (a int, b int, c int) PARTITION BY LIST (a);
@@ -508,8 +508,8 @@ sub wait_for_subscription_sync
2|4),
'partitions with different replica identities not replicated correctly');
-# This time start with a column filter covering RI for all partitions, but
-# then update the column filter to not cover column "b" (needed by the
+# This time start with a column list covering RI for all partitions, but
+# then update the column list to not cover column "b" (needed by the
# second partition)
$node_publisher->safe_psql('postgres', qq(
@@ -563,9 +563,9 @@ sub wait_for_subscription_sync
'partitions with different replica identities not replicated correctly');
-# TEST: This time start with a column filter covering RI for all partitions,
+# TEST: This time start with a column list covering RI for all partitions,
# but then update RI for one of the partitions to not be covered by the
-# column filter anymore.
+# column list anymore.
$node_publisher->safe_psql('postgres', qq(
CREATE TABLE test_part_c (a int, b int, c int) PARTITION BY LIST (a);
@@ -594,7 +594,7 @@ sub wait_for_subscription_sync
# create a publication replicating data through partition root, with a column
# filter on the root, and then add the partitions one by one with separate
-# column filters (but those are not applied)
+# column lists (but those are not applied)
$node_publisher->safe_psql('postgres', qq(
CREATE PUBLICATION pub8 FOR TABLE test_part_c WITH (publish_via_partition_root = false);
ALTER PUBLICATION pub8 ADD TABLE test_part_c_1 (a,c);
@@ -623,8 +623,8 @@ sub wait_for_subscription_sync
# create a publication not replicating data through partition root, without
-# a column filter on the root, and then add the partitions one by one with
-# separate column filters
+# a column list on the root, and then add the partitions one by one with
+# separate column lists
$node_publisher->safe_psql('postgres', qq(
DROP PUBLICATION pub8;
CREATE PUBLICATION pub8 FOR TABLE test_part_c WITH (publish_via_partition_root = false);
@@ -703,7 +703,7 @@ sub wait_for_subscription_sync
'partitions with different replica identities not replicated correctly');
# TEST: With a table included in multiple publications, we should use a
-# union of the column filters. So with column filters (a,b) and (a,c) we
+# union of the column lists. So with column lists (a,b) and (a,c) we
# should replicate (a,b,c).
$node_publisher->safe_psql('postgres', qq(
@@ -727,11 +727,11 @@ sub wait_for_subscription_sync
is($node_subscriber->safe_psql('postgres',"SELECT * FROM test_mix_1"),
qq(1|2|3),
- 'a mix of publications should use a union of column filter');
+ 'a mix of publications should use a union of column list');
# TEST: With a table included in multiple publications, we should use a
-# union of the column filters. If any of the publications is FOR ALL
+# union of the column lists. If any of the publications is FOR ALL
# TABLES, we should replicate all columns.
# drop unnecessary tables, so as not to interfere with the FOR ALL TABLES
@@ -762,11 +762,11 @@ sub wait_for_subscription_sync
is($node_subscriber->safe_psql('postgres',"SELECT * FROM test_mix_2"),
qq(1|2|3),
- 'a mix of publications should use a union of column filter');
+ 'a mix of publications should use a union of column list');
# TEST: With a table included in multiple publications, we should use a
-# union of the column filters. If any of the publications is FOR ALL
+# union of the column lists. If any of the publications is FOR ALL
# TABLES IN SCHEMA, we should replicate all columns.
$node_publisher->safe_psql('postgres', qq(
@@ -790,11 +790,11 @@ sub wait_for_subscription_sync
is($node_subscriber->safe_psql('postgres',"SELECT * FROM test_mix_3"),
qq(1|2|3),
- 'a mix of publications should use a union of column filter');
+ 'a mix of publications should use a union of column list');
# TEST: Check handling of publish_via_partition_root - if a partition is
-# published through partition root, we should only apply the column filter
+# published through partition root, we should only apply the column list
# defined for the whole table (not the partitions) - both during the initial
# sync and when replicating changes. This is what we do for row filters.
@@ -828,7 +828,7 @@ sub wait_for_subscription_sync
is($node_subscriber->safe_psql('postgres',"SELECT * FROM test_root ORDER BY a, b, c"),
qq(1||
10||),
- 'publication via partition root applies column filter');
+ 'publication via partition root applies column list');
$node_subscriber->stop('fast');
$node_publisher->stop('fast');
--
2.35.1