diff options
Diffstat (limited to 'src/backend/commands/publicationcmds.c')
-rw-r--r-- | src/backend/commands/publicationcmds.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c index 404bb5d0c87..f932f47a086 100644 --- a/src/backend/commands/publicationcmds.c +++ b/src/backend/commands/publicationcmds.c @@ -48,7 +48,7 @@ #include "utils/syscache.h" #include "utils/varlena.h" -static List *OpenReliIdList(List *relids); +static List *OpenRelIdList(List *relids); static List *OpenTableList(List *tables); static void CloseTableList(List *rels); static void LockSchemaList(List *schemalist); @@ -169,13 +169,13 @@ ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate, case PUBLICATIONOBJ_TABLE: *rels = lappend(*rels, pubobj->pubtable); break; - case PUBLICATIONOBJ_TABLE_IN_SCHEMA: + case PUBLICATIONOBJ_TABLES_IN_SCHEMA: schemaid = get_namespace_oid(pubobj->name, false); /* Filter out duplicates if user specifies "sch1, sch1" */ *schemas = list_append_unique_oid(*schemas, schemaid); break; - case PUBLICATIONOBJ_TABLE_IN_CUR_SCHEMA: + case PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA: search_path = fetch_search_path(false); if (search_path == NIL) /* nothing valid in search_path? */ ereport(ERROR, @@ -214,7 +214,7 @@ CheckObjSchemaNotAlreadyInPublication(List *rels, List *schemaidlist, if (list_member_oid(schemaidlist, relSchemaId)) { - if (checkobjtype == PUBLICATIONOBJ_TABLE_IN_SCHEMA) + if (checkobjtype == PUBLICATIONOBJ_TABLES_IN_SCHEMA) ereport(ERROR, errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("cannot add schema \"%s\" to publication", @@ -499,8 +499,9 @@ AlterPublicationTables(AlterPublicationStmt *stmt, HeapTuple tup, Oid pubid = pubform->oid; /* - * It is quite possible that for the SET case user has not specified any - * tables in which case we need to remove all the existing tables. + * Nothing to do if no objects, except in SET: for that it is quite + * possible that user has not specified any tables in which case we need + * to remove all the existing tables. */ if (!tables && stmt->action != DEFELEM_SET) return; @@ -593,8 +594,9 @@ AlterPublicationSchemas(AlterPublicationStmt *stmt, Form_pg_publication pubform = (Form_pg_publication) GETSTRUCT(tup); /* - * It is quite possible that for the SET case user has not specified any - * schemas in which case we need to remove all the existing schemas. + * Nothing to do if no objects, except in SET: for that it is quite + * possible that user has not specified any schemas in which case we need + * to remove all the existing schemas. */ if (!schemaidlist && stmt->action != DEFELEM_SET) return; @@ -610,10 +612,10 @@ AlterPublicationSchemas(AlterPublicationStmt *stmt, List *reloids; reloids = GetPublicationRelations(pubform->oid, PUBLICATION_PART_ROOT); - rels = OpenReliIdList(reloids); + rels = OpenRelIdList(reloids); CheckObjSchemaNotAlreadyInPublication(rels, schemaidlist, - PUBLICATIONOBJ_TABLE_IN_SCHEMA); + PUBLICATIONOBJ_TABLES_IN_SCHEMA); CloseTableList(rels); PublicationAddSchemas(pubform->oid, schemaidlist, false, stmt); @@ -813,7 +815,7 @@ RemovePublicationById(Oid pubid) if (!HeapTupleIsValid(tup)) elog(ERROR, "cache lookup failed for publication %u", pubid); - pubform = (Form_pg_publication)GETSTRUCT(tup); + pubform = (Form_pg_publication) GETSTRUCT(tup); /* Invalidate relcache so that publication info is rebuilt. */ if (pubform->puballtables) @@ -868,7 +870,7 @@ RemovePublicationSchemaById(Oid psoid) * add them to a publication. */ static List * -OpenReliIdList(List *relids) +OpenRelIdList(List *relids) { ListCell *lc; List *rels = NIL; |