mirror of https://github.com/citusdata/citus.git
Introduces BeginCopyFrom_compat macro
BeginCopyFrom function now has a new whereClause parameter. In the function this parameter is assigned to the whereClause field of the CopyFromState returned Currently in Postgres there is only one place where this argument isn't NULL, and in previous PG version the whereClause argument of copy state is set right after the function call Since we don't have such example all current whereClause parameters are set to NULL Relevant PG commit: c532d15dddff14b01fe9ef1d465013cb8ef186dfpg14_support_after_rebase
parent
4e2dd2274e
commit
c2f698674f
|
@ -213,9 +213,10 @@ DoLocalCopy(StringInfo buffer, Oid relationId, int64 shardId, CopyStmt *copyStat
|
||||||
/* p_rtable of pState is set so that we can check constraints. */
|
/* p_rtable of pState is set so that we can check constraints. */
|
||||||
pState->p_rtable = CreateRangeTable(shard, ACL_INSERT);
|
pState->p_rtable = CreateRangeTable(shard, ACL_INSERT);
|
||||||
|
|
||||||
CopyFromState_compat cstate = BeginCopyFrom(pState, shard, NULL, false,
|
CopyFromState_compat cstate = BeginCopyFrom_compat(pState, shard, NULL, 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 */
|
||||||
CopyFromState_compat copyState = BeginCopyFrom(NULL,
|
CopyFromState_compat 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 */
|
||||||
CopyFromState_compat copyState = BeginCopyFrom(NULL,
|
CopyFromState_compat 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);
|
||||||
|
|
||||||
CopyFromState_compat copyState = BeginCopyFrom(NULL, stubRelation, fileName, false, NULL,
|
CopyFromState_compat copyState = BeginCopyFrom_compat(NULL, stubRelation, NULL,
|
||||||
|
fileName, false, NULL,
|
||||||
NULL, copyOptions);
|
NULL, copyOptions);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#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
|
#define CopyFromState_compat CopyFromState
|
||||||
|
#define BeginCopyFrom_compat(a, b, c, d, e, f, g, h) BeginCopyFrom(a, b, c, d, e, f, g, h)
|
||||||
#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
|
||||||
|
@ -71,6 +72,7 @@
|
||||||
((strcmp(param, "verbose") == 0) ? ((reindex)->options == REINDEXOPT_VERBOSE) : \
|
((strcmp(param, "verbose") == 0) ? ((reindex)->options == REINDEXOPT_VERBOSE) : \
|
||||||
false))
|
false))
|
||||||
#define CopyFromState_compat CopyState
|
#define CopyFromState_compat CopyState
|
||||||
|
#define BeginCopyFrom_compat(a, b, c, d, e, f, g, h) BeginCopyFrom(a, b, d, e, f, g, h)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= PG_VERSION_13
|
#if PG_VERSION_NUM >= PG_VERSION_13
|
||||||
|
|
Loading…
Reference in New Issue