mirror of https://github.com/citusdata/citus.git
Use CMDTAG_SELECT_COMPAT
CMDTAG_SELECT exists in PG12 hence defining a MACRO such as CMDTAG_SELECT -> "SELECT" is not possible. I chose CMDTAG_SELECT_COMPAT because with the COMPAT suffix it is explicit that it maps to different things in different versions and also has a less chance of mapping something irrevelant. For example if we used SELECT as a macro, then it would map every SELECT to whatever it is mapping to, which might have unexpected/undesired behaviour.pull/3900/head
parent
d68bfc5687
commit
b641f63bfd
|
@ -2821,8 +2821,8 @@ ProcessCopyStmt(CopyStmt *copyStatement, QueryCompletionCompat *completionTag, c
|
||||||
|
|
||||||
/* consider using RangeVarGetRelidExtended to check perms before locking */
|
/* consider using RangeVarGetRelidExtended to check perms before locking */
|
||||||
Relation copiedRelation = table_openrv(copyStatement->relation,
|
Relation copiedRelation = table_openrv(copyStatement->relation,
|
||||||
isFrom ? RowExclusiveLock :
|
isFrom ? RowExclusiveLock :
|
||||||
AccessShareLock);
|
AccessShareLock);
|
||||||
|
|
||||||
bool isCitusRelation = IsCitusTable(RelationGetRelid(copiedRelation));
|
bool isCitusRelation = IsCitusTable(RelationGetRelid(copiedRelation));
|
||||||
|
|
||||||
|
|
|
@ -628,11 +628,12 @@ ExecutePlanIntoDestReceiver(PlannedStmt *queryPlan, ParamListInfo params,
|
||||||
/* don't display the portal in pg_cursors, it is for internal use only */
|
/* don't display the portal in pg_cursors, it is for internal use only */
|
||||||
portal->visible = false;
|
portal->visible = false;
|
||||||
|
|
||||||
PortalDefineQuerySelectCompat(portal,
|
PortalDefineQuery(portal,
|
||||||
NULL,
|
NULL,
|
||||||
"",
|
"",
|
||||||
list_make1(queryPlan),
|
CMDTAG_SELECT_COMPAT,
|
||||||
NULL);
|
list_make1(queryPlan),
|
||||||
|
NULL);
|
||||||
|
|
||||||
PortalStart(portal, params, eflags, GetActiveSnapshot());
|
PortalStart(portal, params, eflags, GetActiveSnapshot());
|
||||||
PortalRun(portal, count, false, true, dest, dest, NULL);
|
PortalRun(portal, count, false, true, dest, dest, NULL);
|
||||||
|
|
|
@ -266,7 +266,8 @@ StartPortalForQueryExecution(const char *queryString)
|
||||||
/* don't display the portal in pg_cursors, it is for internal use only */
|
/* don't display the portal in pg_cursors, it is for internal use only */
|
||||||
portal->visible = false;
|
portal->visible = false;
|
||||||
|
|
||||||
PortalDefineQuerySelectCompat(portal, NULL, queryString, list_make1(queryPlan), NULL);
|
PortalDefineQuery(portal, NULL, queryString, CMDTAG_SELECT_COMPAT, list_make1(
|
||||||
|
queryPlan), NULL);
|
||||||
int eflags = 0;
|
int eflags = 0;
|
||||||
PortalStart(portal, NULL, eflags, GetActiveSnapshot());
|
PortalStart(portal, NULL, eflags, GetActiveSnapshot());
|
||||||
|
|
||||||
|
|
|
@ -634,7 +634,7 @@ NodeGroupHasShardPlacements(int32 groupId, bool onlyConsiderActivePlacements)
|
||||||
ScanKeyData scanKey[2];
|
ScanKeyData scanKey[2];
|
||||||
|
|
||||||
Relation pgPlacement = table_open(DistPlacementRelationId(),
|
Relation pgPlacement = table_open(DistPlacementRelationId(),
|
||||||
AccessShareLock);
|
AccessShareLock);
|
||||||
|
|
||||||
ScanKeyInit(&scanKey[0], Anum_pg_dist_placement_groupid,
|
ScanKeyInit(&scanKey[0], Anum_pg_dist_placement_groupid,
|
||||||
BTEqualStrategyNumber, F_INT4EQ, Int32GetDatum(groupId));
|
BTEqualStrategyNumber, F_INT4EQ, Int32GetDatum(groupId));
|
||||||
|
|
|
@ -95,7 +95,8 @@ LogTransactionRecord(int32 groupId, char *transactionName)
|
||||||
values[Anum_pg_dist_transaction_gid - 1] = CStringGetTextDatum(transactionName);
|
values[Anum_pg_dist_transaction_gid - 1] = CStringGetTextDatum(transactionName);
|
||||||
|
|
||||||
/* open transaction relation and insert new tuple */
|
/* open transaction relation and insert new tuple */
|
||||||
Relation pgDistTransaction = table_open(DistTransactionRelationId(), RowExclusiveLock);
|
Relation pgDistTransaction = table_open(DistTransactionRelationId(),
|
||||||
|
RowExclusiveLock);
|
||||||
|
|
||||||
TupleDesc tupleDescriptor = RelationGetDescr(pgDistTransaction);
|
TupleDesc tupleDescriptor = RelationGetDescr(pgDistTransaction);
|
||||||
HeapTuple heapTuple = heap_form_tuple(tupleDescriptor, values, isNulls);
|
HeapTuple heapTuple = heap_form_tuple(tupleDescriptor, values, isNulls);
|
||||||
|
@ -172,7 +173,7 @@ RecoverWorkerTransactions(WorkerNode *workerNode)
|
||||||
|
|
||||||
/* take table lock first to avoid running concurrently */
|
/* take table lock first to avoid running concurrently */
|
||||||
Relation pgDistTransaction = table_open(DistTransactionRelationId(),
|
Relation pgDistTransaction = table_open(DistTransactionRelationId(),
|
||||||
ShareUpdateExclusiveLock);
|
ShareUpdateExclusiveLock);
|
||||||
TupleDesc tupleDescriptor = RelationGetDescr(pgDistTransaction);
|
TupleDesc tupleDescriptor = RelationGetDescr(pgDistTransaction);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -34,10 +34,8 @@
|
||||||
#define pg_plan_query_compat(p, q, c, b) pg_plan_query(p, q, c, b)
|
#define pg_plan_query_compat(p, q, c, b) pg_plan_query(p, q, c, b)
|
||||||
#define planner_compat(p, c, b) planner(p, NULL, c, b)
|
#define planner_compat(p, c, b) planner(p, NULL, c, b)
|
||||||
#define standard_planner_compat(a, c, d) standard_planner(a, NULL, c, d)
|
#define standard_planner_compat(a, c, d) standard_planner(a, NULL, c, d)
|
||||||
#define PortalDefineQuerySelectCompat(a, b, c, d, e) PortalDefineQuery(a, b, c, \
|
|
||||||
CMDTAG_SELECT, d, \
|
|
||||||
e)
|
|
||||||
#define getOwnedSequencesCompat(a, b) getOwnedSequences(a)
|
#define getOwnedSequencesCompat(a, b) getOwnedSequences(a)
|
||||||
|
#define CMDTAG_SELECT_COMPAT CMDTAG_SELECT
|
||||||
#define ExplainOnePlanCompat(a, b, c, d, e, f, g) ExplainOnePlan(a, b, c, d, e, f, g, \
|
#define ExplainOnePlanCompat(a, b, c, d, e, f, g) ExplainOnePlan(a, b, c, d, e, f, g, \
|
||||||
NULL)
|
NULL)
|
||||||
#define varoattno varattnosyn
|
#define varoattno varattnosyn
|
||||||
|
@ -51,8 +49,7 @@
|
||||||
#define pg_plan_query_compat(p, q, c, b) pg_plan_query(p, c, b)
|
#define pg_plan_query_compat(p, q, c, b) pg_plan_query(p, c, b)
|
||||||
#define planner_compat(p, c, b) planner(p, c, b)
|
#define planner_compat(p, c, b) planner(p, c, b)
|
||||||
#define standard_planner_compat(a, c, d) standard_planner(a, c, d)
|
#define standard_planner_compat(a, c, d) standard_planner(a, c, d)
|
||||||
#define PortalDefineQuerySelectCompat(a, b, c, d, e) PortalDefineQuery(a, b, c, "SELECT", \
|
#define CMDTAG_SELECT_COMPAT "SELECT"
|
||||||
d, e)
|
|
||||||
#define getOwnedSequencesCompat(a, b) getOwnedSequences(a, b)
|
#define getOwnedSequencesCompat(a, b) getOwnedSequences(a, b)
|
||||||
#define ExplainOnePlanCompat(a, b, c, d, e, f, g) ExplainOnePlan(a, b, c, d, e, f, g)
|
#define ExplainOnePlanCompat(a, b, c, d, e, f, g) ExplainOnePlan(a, b, c, d, e, f, g)
|
||||||
#define Set_ptr_value(a, b) ((a)->data.ptr_value = (b))
|
#define Set_ptr_value(a, b) ((a)->data.ptr_value = (b))
|
||||||
|
|
Loading…
Reference in New Issue