mirror of https://github.com/citusdata/citus.git
addres rev
parent
8535064b52
commit
2071ef2a60
|
|
@ -345,8 +345,13 @@ CreateCitusLocalTable(Oid relationId, bool cascadeViaForeignKeys, bool autoConve
|
||||||
ExecuteAndLogUtilityCommandList(shellTableDDLEvents);
|
ExecuteAndLogUtilityCommandList(shellTableDDLEvents);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Execute the view creation commands with the shell table.
|
* Execute the view creation commands with the shell table. Since we want to create
|
||||||
|
* views locally here, disable/enable ddl propagation. Views will be distributed via
|
||||||
|
* FinalizeCitusLocalTableCreation below.
|
||||||
*/
|
*/
|
||||||
|
tableViewCreationCommands = lcons(DISABLE_DDL_PROPAGATION, tableViewCreationCommands);
|
||||||
|
tableViewCreationCommands = lappend(tableViewCreationCommands,
|
||||||
|
ENABLE_DDL_PROPAGATION);
|
||||||
ExecuteAndLogUtilityCommandList(tableViewCreationCommands);
|
ExecuteAndLogUtilityCommandList(tableViewCreationCommands);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1036,9 +1041,20 @@ static void
|
||||||
DropViewsOnTable(Oid relationId)
|
DropViewsOnTable(Oid relationId)
|
||||||
{
|
{
|
||||||
List *views = GetDependingViews(relationId);
|
List *views = GetDependingViews(relationId);
|
||||||
|
List *reverseOrderedViews = NIL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GetDependingViews returns views in the dependency order. We should drop views
|
||||||
|
* in the reversed order since dropping views can cascade to other views below ...
|
||||||
|
*/
|
||||||
Oid viewId = InvalidOid;
|
Oid viewId = InvalidOid;
|
||||||
foreach_oid(viewId, views)
|
foreach_oid(viewId, views)
|
||||||
|
{
|
||||||
|
reverseOrderedViews = list_insert_nth_oid(reverseOrderedViews, 0, viewId);
|
||||||
|
}
|
||||||
|
|
||||||
|
viewId = InvalidOid;
|
||||||
|
foreach_oid(viewId, reverseOrderedViews)
|
||||||
{
|
{
|
||||||
char *viewName = get_rel_name(viewId);
|
char *viewName = get_rel_name(viewId);
|
||||||
char *schemaName = get_namespace_name(get_rel_namespace(viewId));
|
char *schemaName = get_namespace_name(get_rel_namespace(viewId));
|
||||||
|
|
|
||||||
|
|
@ -350,14 +350,17 @@ CreateDependentViewsOnWorkers(Oid relationId)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObjectAddress viewAddress = { 0 };
|
||||||
|
ObjectAddressSet(viewAddress, RelationRelationId, viewOid);
|
||||||
|
|
||||||
|
EnsureDependenciesExistOnAllNodes(&viewAddress);
|
||||||
|
|
||||||
char *createViewCommand = CreateViewDDLCommand(viewOid);
|
char *createViewCommand = CreateViewDDLCommand(viewOid);
|
||||||
char *alterViewOwnerCommand = AlterViewOwnerCommand(viewOid);
|
char *alterViewOwnerCommand = AlterViewOwnerCommand(viewOid);
|
||||||
|
|
||||||
SendCommandToWorkersWithMetadata(createViewCommand);
|
SendCommandToWorkersWithMetadata(createViewCommand);
|
||||||
SendCommandToWorkersWithMetadata(alterViewOwnerCommand);
|
SendCommandToWorkersWithMetadata(alterViewOwnerCommand);
|
||||||
|
|
||||||
ObjectAddress viewAddress = { 0 };
|
|
||||||
ObjectAddressSet(viewAddress, RelationRelationId, viewOid);
|
|
||||||
MarkObjectDistributed(&viewAddress);
|
MarkObjectDistributed(&viewAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue