aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/publicationcmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/publicationcmds.c')
-rw-r--r--src/backend/commands/publicationcmds.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 6ea709988ee..d6ffef374ea 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -1176,21 +1176,13 @@ AlterPublicationTables(AlterPublicationStmt *stmt, HeapTuple tup,
newrelid = RelationGetRelid(newpubrel->relation);
/*
- * If the new publication has column list, transform it to a
- * bitmap too.
+ * Validate the column list. If the column list or WHERE
+ * clause changes, then the validation done here will be
+ * duplicated inside PublicationAddTables(). The validation
+ * is cheap enough that that seems harmless.
*/
- if (newpubrel->columns)
- {
- ListCell *lc;
-
- foreach(lc, newpubrel->columns)
- {
- char *colname = strVal(lfirst(lc));
- AttrNumber attnum = get_attnum(newrelid, colname);
-
- newcolumns = bms_add_member(newcolumns, attnum);
- }
- }
+ newcolumns = pub_collist_validate(newpubrel->relation,
+ newpubrel->columns);
/*
* Check if any of the new set of relations matches with the
@@ -1199,7 +1191,7 @@ AlterPublicationTables(AlterPublicationStmt *stmt, HeapTuple tup,
* expressions also match. Same for the column list. Drop the
* rest.
*/
- if (RelationGetRelid(newpubrel->relation) == oldrelid)
+ if (newrelid == oldrelid)
{
if (equal(oldrelwhereclause, newpubrel->whereClause) &&
bms_equal(oldcolumns, newcolumns))