Handle BeginCopyFrom changes

BeginCopyFrom now accepts a ParseState and callback argument, but it's
again fine to just NULL out both arguments.
pull/1439/head
Jason Petersen 2017-04-19 20:42:44 -06:00
parent caaaa2c9f7
commit 300349e646
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
2 changed files with 25 additions and 0 deletions

View File

@ -356,11 +356,21 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
dest->rStartup(dest, 0, tupleDescriptor);
/* initialize copy state to read from COPY data source */
#if (PG_VERSION_NUM >= 100000)
copyState = BeginCopyFrom(NULL,
distributedRelation,
copyStatement->filename,
copyStatement->is_program,
NULL,
copyStatement->attlist,
copyStatement->options);
#else
copyState = BeginCopyFrom(distributedRelation,
copyStatement->filename,
copyStatement->is_program,
copyStatement->attlist,
copyStatement->options);
#endif
/* set up callback to identify error line number */
errorCallback.callback = CopyFromErrorCallback;
@ -455,11 +465,21 @@ CopyToNewShards(CopyStmt *copyStatement, char *completionTag, Oid relationId)
(ShardConnections *) palloc0(sizeof(ShardConnections));
/* initialize copy state to read from COPY data source */
#if (PG_VERSION_NUM >= 100000)
CopyState copyState = BeginCopyFrom(NULL,
distributedRelation,
copyStatement->filename,
copyStatement->is_program,
NULL,
copyStatement->attlist,
copyStatement->options);
#else
CopyState copyState = BeginCopyFrom(distributedRelation,
copyStatement->filename,
copyStatement->is_program,
copyStatement->attlist,
copyStatement->options);
#endif
CopyOutState copyOutState = (CopyOutState) palloc0(sizeof(CopyOutStateData));
copyOutState->delim = (char *) delimiterCharacter;

View File

@ -310,8 +310,13 @@ LoadTuplesIntoTupleStore(CitusScanState *citusScanState, Job *workerJob)
jobDirectoryName = MasterJobDirectoryName(workerTask->jobId);
taskFilename = TaskFilename(jobDirectoryName, workerTask->taskId);
#if (PG_VERSION_NUM >= 100000)
copyState = BeginCopyFrom(NULL, stubRelation, taskFilename->data, false, NULL,
NULL, copyOptions);
#else
copyState = BeginCopyFrom(stubRelation, taskFilename->data, false, NULL,
copyOptions);
#endif
while (true)
{