diff --git a/src/backend/distributed/worker/worker_data_fetch_protocol.c b/src/backend/distributed/worker/worker_data_fetch_protocol.c index 9bf12431e..5bad5a156 100644 --- a/src/backend/distributed/worker/worker_data_fetch_protocol.c +++ b/src/backend/distributed/worker/worker_data_fetch_protocol.c @@ -852,8 +852,6 @@ FetchRegularTable(const char *nodeName, uint32 nodePort, const char *tableName) CommandCounterIncrement(); } - SetUserIdAndSecContext(savedUserId, savedSecurityContext); - /* * Copy local file into the relation. We call ProcessUtility() instead of * directly calling DoCopy() because some extensions (e.g. cstore_fdw) hook @@ -872,6 +870,8 @@ FetchRegularTable(const char *nodeName, uint32 nodePort, const char *tableName) /* finally delete the temporary file we created */ DeleteFile(localFilePath->data); + SetUserIdAndSecContext(savedUserId, savedSecurityContext); + return true; }