summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2014-09-09 13:06:28 +0000
committerPavan Deolasee2014-09-09 13:14:25 +0000
commita491e1c4eb51823dafaf868b7a9ef145493f2a1f (patch)
tree8f3b694803046b2c2a6accbf37a0eee7ea49141d
parent8f3ef7b87cfcdfef73616a31e5103b4680f7ca7c (diff)
Fix double discounting of \n in COPY results received from datanodes
We strip the \n while storing the COPY result in tuple store during table redistribution. We were mistakenly again trying to strip (the non-existent) last character after fetching tuple from the store. This patch fixes that.
-rw-r--r--src/backend/pgxc/locator/redistrib.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/pgxc/locator/redistrib.c b/src/backend/pgxc/locator/redistrib.c
index 8a5ab4e551..7385290b24 100644
--- a/src/backend/pgxc/locator/redistrib.c
+++ b/src/backend/pgxc/locator/redistrib.c
@@ -561,7 +561,11 @@ distrib_copy_from(RedistribState *distribState, ExecNodes *exec_nodes)
Datum value = (Datum) 0;
bool is_null = true;
- /* Get message from the tuplestore */
+ /*
+ * Get message from the tuplestore
+ *
+ * The trailing \n is already removed while storing the message.
+ */
data = tuplestore_getmessage(store, &len);
if (!data)
break;
@@ -573,9 +577,8 @@ distrib_copy_from(RedistribState *distribState, ExecNodes *exec_nodes)
/*
* Split message on an array of fields.
- * Last \n is not included in converted message.
*/
- fields = CopyOps_RawDataToArrayField(tupdesc, data, len - 1);
+ fields = CopyOps_RawDataToArrayField(tupdesc, data, len);
Assert(partIdx >= 0);
/* Determine partitioning value */