mirror of https://github.com/citusdata/citus.git
Introduces CopyFromState_compat macro
CopyState struct is divided into parts and one of them is CopyFromState This macro uses the appropriate one for PG versions Relevant PG commit: c532d15dddff14b01fe9ef1d465013cb8ef186dfpull/5209/head
parent
8f34f84ce6
commit
35cfa5d7b9
|
@ -209,13 +209,12 @@ DoLocalCopy(StringInfo buffer, Oid relationId, int64 shardId, CopyStmt *copyStat
|
||||||
Oid shardOid = GetTableLocalShardOid(relationId, shardId);
|
Oid shardOid = GetTableLocalShardOid(relationId, shardId);
|
||||||
Relation shard = table_open(shardOid, RowExclusiveLock);
|
Relation shard = table_open(shardOid, RowExclusiveLock);
|
||||||
ParseState *pState = make_parsestate(NULL);
|
ParseState *pState = make_parsestate(NULL);
|
||||||
|
(void) addRangeTableEntryForRelation(pState, shard, AccessShareLock,
|
||||||
/* p_rtable of pState is set so that we can check constraints. */
|
NULL, false, false);
|
||||||
pState->p_rtable = CreateRangeTable(shard, ACL_INSERT);
|
CopyFromState cstate = BeginCopyFrom_compat(pState, shard, NULL, NULL, false,
|
||||||
|
|
||||||
CopyState cstate = BeginCopyFrom(pState, shard, NULL, false,
|
|
||||||
ReadFromLocalBufferCallback,
|
ReadFromLocalBufferCallback,
|
||||||
copyStatement->attlist, copyStatement->options);
|
copyStatement->attlist,
|
||||||
|
copyStatement->options);
|
||||||
CopyFrom(cstate);
|
CopyFrom(cstate);
|
||||||
EndCopyFrom(cstate);
|
EndCopyFrom(cstate);
|
||||||
|
|
||||||
|
|
|
@ -520,8 +520,9 @@ CopyToExistingShards(CopyStmt *copyStatement, QueryCompletionCompat *completionT
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize copy state to read from COPY data source */
|
/* initialize copy state to read from COPY data source */
|
||||||
CopyState copyState = BeginCopyFrom(NULL,
|
CopyFromState copyState = BeginCopyFrom_compat(NULL,
|
||||||
copiedDistributedRelation,
|
copiedDistributedRelation,
|
||||||
|
NULL,
|
||||||
copyStatement->filename,
|
copyStatement->filename,
|
||||||
copyStatement->is_program,
|
copyStatement->is_program,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -617,8 +618,9 @@ CopyToNewShards(CopyStmt *copyStatement, QueryCompletionCompat *completionTag, O
|
||||||
(ShardConnections *) palloc0(sizeof(ShardConnections));
|
(ShardConnections *) palloc0(sizeof(ShardConnections));
|
||||||
|
|
||||||
/* initialize copy state to read from COPY data source */
|
/* initialize copy state to read from COPY data source */
|
||||||
CopyState copyState = BeginCopyFrom(NULL,
|
CopyFromState copyState = BeginCopyFrom_compat(NULL,
|
||||||
distributedRelation,
|
distributedRelation,
|
||||||
|
NULL,
|
||||||
copyStatement->filename,
|
copyStatement->filename,
|
||||||
copyStatement->is_program,
|
copyStatement->is_program,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -410,7 +410,8 @@ ReadFileIntoTupleStore(char *fileName, char *copyFormat, TupleDesc tupleDescript
|
||||||
location);
|
location);
|
||||||
copyOptions = lappend(copyOptions, copyOption);
|
copyOptions = lappend(copyOptions, copyOption);
|
||||||
|
|
||||||
CopyState copyState = BeginCopyFrom(NULL, stubRelation, fileName, false, NULL,
|
CopyFromState copyState = BeginCopyFrom_compat(NULL, stubRelation, NULL,
|
||||||
|
fileName, false, NULL,
|
||||||
NULL, copyOptions);
|
NULL, copyOptions);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#define VACOPTVALUE_DISABLED_COMPAT VACOPTVALUE_DISABLED
|
#define VACOPTVALUE_DISABLED_COMPAT VACOPTVALUE_DISABLED
|
||||||
#define VACOPTVALUE_ENABLED_COMPAT VACOPTVALUE_ENABLED
|
#define VACOPTVALUE_ENABLED_COMPAT VACOPTVALUE_ENABLED
|
||||||
#define IsReindexWithParam_compat(reindex, param) IsReindexWithParam(reindex, param)
|
#define IsReindexWithParam_compat(reindex, param) IsReindexWithParam(reindex, param)
|
||||||
|
#define CopyFromState_compat CopyFromState
|
||||||
#else
|
#else
|
||||||
#define AlterTableStmtObjType(a) ((a)->relkind)
|
#define AlterTableStmtObjType(a) ((a)->relkind)
|
||||||
#define F_NEXTVAL_COMPAT F_NEXTVAL_OID
|
#define F_NEXTVAL_COMPAT F_NEXTVAL_OID
|
||||||
|
@ -69,6 +70,7 @@
|
||||||
((strcmp(param, "concurrently") == 0) ? ((reindex)->concurrent) : \
|
((strcmp(param, "concurrently") == 0) ? ((reindex)->concurrent) : \
|
||||||
((strcmp(param, "verbose") == 0) ? ((reindex)->options == REINDEXOPT_VERBOSE) : \
|
((strcmp(param, "verbose") == 0) ? ((reindex)->options == REINDEXOPT_VERBOSE) : \
|
||||||
false))
|
false))
|
||||||
|
#define CopyFromState_compat CopyState
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= PG_VERSION_13
|
#if PG_VERSION_NUM >= PG_VERSION_13
|
||||||
|
|
Loading…
Reference in New Issue