* 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)
+ if (!tables && stmt->action != AP_SetObjects)
return;
rels = OpenTableList(tables);
- if (stmt->action == DEFELEM_ADD)
+ if (stmt->action == AP_AddObjects)
{
List *schemas = NIL;
PUBLICATIONOBJ_TABLE);
PublicationAddTables(pubid, rels, false, stmt);
}
- else if (stmt->action == DEFELEM_DROP)
+ else if (stmt->action == AP_DropObjects)
PublicationDropTables(pubid, rels, false);
- else /* DEFELEM_SET */
+ else /* AP_SetObjects */
{
List *oldrelids = GetPublicationRelations(pubid,
PUBLICATION_PART_ROOT);
* 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)
+ if (!schemaidlist && stmt->action != AP_SetObjects)
return;
/*
* concurrent schema deletion.
*/
LockSchemaList(schemaidlist);
- if (stmt->action == DEFELEM_ADD)
+ if (stmt->action == AP_AddObjects)
{
List *rels;
List *reloids;
CloseTableList(rels);
PublicationAddSchemas(pubform->oid, schemaidlist, false, stmt);
}
- else if (stmt->action == DEFELEM_DROP)
+ else if (stmt->action == AP_DropObjects)
PublicationDropSchemas(pubform->oid, schemaidlist, false);
- else /* DEFELEM_SET */
+ else /* AP_SetObjects */
{
List *oldschemaids = GetPublicationSchemas(pubform->oid);
List *delschemas = NIL;
{
Form_pg_publication pubform = (Form_pg_publication) GETSTRUCT(tup);
- if ((stmt->action == DEFELEM_ADD || stmt->action == DEFELEM_SET) &&
+ if ((stmt->action == AP_AddObjects || stmt->action == AP_SetObjects) &&
schemaidlist && !superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
n->pubname = $3;
n->pubobjects = $5;
preprocess_pubobj_list(n->pubobjects, yyscanner);
- n->action = DEFELEM_ADD;
+ n->action = AP_AddObjects;
$$ = (Node *)n;
}
| ALTER PUBLICATION name SET pub_obj_list
n->pubname = $3;
n->pubobjects = $5;
preprocess_pubobj_list(n->pubobjects, yyscanner);
- n->action = DEFELEM_SET;
+ n->action = AP_SetObjects;
$$ = (Node *)n;
}
| ALTER PUBLICATION name DROP pub_obj_list
n->pubname = $3;
n->pubobjects = $5;
preprocess_pubobj_list(n->pubobjects, yyscanner);
- n->action = DEFELEM_DROP;
+ n->action = AP_DropObjects;
$$ = (Node *)n;
}
;
bool for_all_tables; /* Special publication for all tables in db */
} CreatePublicationStmt;
+typedef enum AlterPublicationAction
+{
+ AP_AddObjects, /* add objects to publication */
+ AP_DropObjects, /* remove objects from publication */
+ AP_SetObjects /* set list of objects */
+} AlterPublicationAction;
+
typedef struct AlterPublicationStmt
{
NodeTag type;
*/
List *pubobjects; /* Optional list of publication objects */
bool for_all_tables; /* Special publication for all tables in db */
- DefElemAction action; /* What action to perform with the
- * tables/schemas */
+ AlterPublicationAction action; /* What action to perform with the given
+ * objects */
} AlterPublicationStmt;
typedef struct CreateSubscriptionStmt