MultiClientCopyData in multi_client_executor.c and CopyDataFromConnection in intermediate_results.c do the same thing with slight differences. Both implement the logic described in https://www.postgresql.org/docs/current/libpq-copy.html. We should unify them to avoid code duplication.
I've created a branch merge-copy-data-from-conn-to-file-functions which unifies the functions by using a function pointer for write. It drops an error message, "could not read data from worker node"
MultiClientCopyData
inmulti_client_executor.c
andCopyDataFromConnection
inintermediate_results.c
do the same thing with slight differences. Both implement the logic described in https://www.postgresql.org/docs/current/libpq-copy.html. We should unify them to avoid code duplication.