enable local execution for TRUNCATE command on distributed & reference tables

improve-drop-trigger2
Onur Tirtir 2020-02-13 16:11:40 +03:00
parent 38a59b4767
commit c162755cc5
1 changed files with 9 additions and 1 deletions

View File

@ -73,7 +73,15 @@ citus_truncate_trigger(PG_FUNCTION_ARGS)
{
List *taskList = TruncateTaskList(relationId);
ExecuteUtilityTaskListWithoutResults(taskList);
/*
* If it is a local placement of a distributed table or a reference table,
* then execute TRUNCATE command locally.
*/
bool localExecutionSupported = true;
UseCoordinatedTransaction();
ExecuteUtilityTaskListWithoutResults(taskList, localExecutionSupported);
}
PG_RETURN_DATUM(PointerGetDatum(NULL));