mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Rename some enums to use TABLE instead of REL.
Commit 5a2832465f introduced some enums to represent all tables in schema
publications and used REL in their names. Use TABLE instead of REL in
those enums to avoid confusion with other objects like SEQUENCES that can
be part of a publication in the future.
In the passing, (a) Change one of the newly introduced error messages to
make it consistent for Create and Alter commands, (b) add missing alias in
one of the SQL Statements that is used to print publications associated
with the table.
Reported-by: Tomas Vondra, Peter Smith
Author: Vignesh C
Reviewed-by: Hou Zhijie, Peter Smith
Discussion: https://www.postgresql.org/message-id/CALDaNm0OANxuJ6RXqwZsM1MSY4s19nuH3734j4a72etDwvBETQ%40mail.gmail.com
This commit is contained in:
@@ -169,13 +169,13 @@ ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate,
|
||||
case PUBLICATIONOBJ_TABLE:
|
||||
*rels = lappend(*rels, pubobj->pubtable);
|
||||
break;
|
||||
case PUBLICATIONOBJ_REL_IN_SCHEMA:
|
||||
case PUBLICATIONOBJ_TABLE_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_CURRSCHEMA:
|
||||
case PUBLICATIONOBJ_TABLE_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_REL_IN_SCHEMA)
|
||||
if (checkobjtype == PUBLICATIONOBJ_TABLE_IN_SCHEMA)
|
||||
ereport(ERROR,
|
||||
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("cannot add schema \"%s\" to publication",
|
||||
@@ -613,7 +613,7 @@ AlterPublicationSchemas(AlterPublicationStmt *stmt,
|
||||
rels = OpenReliIdList(reloids);
|
||||
|
||||
CheckObjSchemaNotAlreadyInPublication(rels, schemaidlist,
|
||||
PUBLICATIONOBJ_REL_IN_SCHEMA);
|
||||
PUBLICATIONOBJ_TABLE_IN_SCHEMA);
|
||||
|
||||
CloseTableList(rels);
|
||||
PublicationAddSchemas(pubform->oid, schemaidlist, false, stmt);
|
||||
|
||||
Reference in New Issue
Block a user