mirror of https://github.com/citusdata/citus.git
Fix code only enabled for 9.5.
There's still supporting wrappers used, a subsequent commit will remove those. This also removes the already unused tuplecount_t define.pull/1470/head
parent
60c28ce7a6
commit
b96ba9b490
|
@ -21,9 +21,7 @@
|
|||
#include "catalog/dependency.h"
|
||||
#include "catalog/index.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
#include "catalog/pg_constraint_fn.h"
|
||||
#endif
|
||||
#include "catalog/pg_enum.h"
|
||||
#include "catalog/pg_extension.h"
|
||||
#include "catalog/pg_opclass.h"
|
||||
|
|
|
@ -132,13 +132,8 @@ static inline void CopyFlushOutput(CopyOutState outputState, char *start, char *
|
|||
/* CitusCopyDestReceiver functions */
|
||||
static void CitusCopyDestReceiverStartup(DestReceiver *copyDest, int operation,
|
||||
TupleDesc inputTupleDesc);
|
||||
#if PG_VERSION_NUM >= 90600
|
||||
static bool CitusCopyDestReceiverReceive(TupleTableSlot *slot,
|
||||
DestReceiver *copyDest);
|
||||
#else
|
||||
static void CitusCopyDestReceiverReceive(TupleTableSlot *slot,
|
||||
DestReceiver *copyDest);
|
||||
#endif
|
||||
static void CitusCopyDestReceiverShutdown(DestReceiver *destReceiver);
|
||||
static void CitusCopyDestReceiverDestroy(DestReceiver *destReceiver);
|
||||
|
||||
|
@ -1837,11 +1832,7 @@ CitusCopyDestReceiverStartup(DestReceiver *dest, int operation,
|
|||
* CitusCopyDestReceiver. It takes a TupleTableSlot and sends the contents to
|
||||
* the appropriate shard placement(s).
|
||||
*/
|
||||
#if PG_VERSION_NUM >= 90600
|
||||
static bool
|
||||
#else
|
||||
static void
|
||||
#endif
|
||||
CitusCopyDestReceiverReceive(TupleTableSlot *slot, DestReceiver *dest)
|
||||
{
|
||||
CitusCopyDestReceiver *copyDest = (CitusCopyDestReceiver *) dest;
|
||||
|
@ -1949,9 +1940,7 @@ CitusCopyDestReceiverReceive(TupleTableSlot *slot, DestReceiver *dest)
|
|||
|
||||
copyDest->tuplesSent++;
|
||||
|
||||
#if PG_VERSION_NUM >= 90600
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -137,9 +137,7 @@ ExecuteIntoDestReceiver(Query *query, ParamListInfo params, DestReceiver *dest)
|
|||
/* don't display the portal in pg_cursors, it is for internal use only */
|
||||
portal->visible = false;
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
cursorOptions = CURSOR_OPT_PARALLEL_OK;
|
||||
#endif
|
||||
|
||||
/* plan the subquery, this may be another distributed query */
|
||||
queryPlan = pg_plan_query(query, cursorOptions, params);
|
||||
|
|
|
@ -775,12 +775,6 @@ ExecuteSingleModifyTask(CitusScanState *scanState, Task *task, bool expectResult
|
|||
taskPlacement->nodeName, taskPlacement->nodePort)));
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM < 90600)
|
||||
|
||||
/* before 9.6, PostgreSQL used a uint32 for this field, so check */
|
||||
Assert(currentAffectedTupleCount <= 0xFFFFFFFF);
|
||||
#endif
|
||||
|
||||
resultsOK = true;
|
||||
gotResults = true;
|
||||
}
|
||||
|
@ -1487,11 +1481,6 @@ ConsumeQueryResult(MultiConnection *connection, bool failOnError, int64 *rows)
|
|||
Assert(currentAffectedTupleCount >= 0);
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM < 90600)
|
||||
|
||||
/* before 9.6, PostgreSQL used a uint32 for this field, so check */
|
||||
Assert(currentAffectedTupleCount <= 0xFFFFFFFF);
|
||||
#endif
|
||||
*rows += currentAffectedTupleCount;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1383,9 +1383,7 @@ DeparseVacuumStmtPrefix(VacuumStmt *vacuumStmt)
|
|||
int vacuumFlags = vacuumStmt->options;
|
||||
const int unsupportedFlags PG_USED_FOR_ASSERTS_ONLY = ~(
|
||||
VACOPT_ANALYZE |
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
VACOPT_DISABLE_PAGE_SKIPPING |
|
||||
#endif
|
||||
VACOPT_FREEZE |
|
||||
VACOPT_FULL
|
||||
);
|
||||
|
@ -1419,12 +1417,10 @@ DeparseVacuumStmtPrefix(VacuumStmt *vacuumStmt)
|
|||
appendStringInfoString(vacuumPrefix, "ANALYZE,");
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
if (vacuumFlags & VACOPT_DISABLE_PAGE_SKIPPING)
|
||||
{
|
||||
appendStringInfoString(vacuumPrefix, "DISABLE_PAGE_SKIPPING,");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (vacuumFlags & VACOPT_FREEZE)
|
||||
{
|
||||
|
|
|
@ -33,9 +33,7 @@
|
|||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_class.h"
|
||||
#include "catalog/pg_constraint.h"
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
#include "catalog/pg_constraint_fn.h"
|
||||
#endif
|
||||
#include "catalog/pg_index.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "catalog/pg_namespace.h"
|
||||
|
|
|
@ -618,10 +618,8 @@ ExplainOneQuery(Query *query, IntoClause *into, ExplainState *es,
|
|||
/* plan the query */
|
||||
#if (PG_VERSION_NUM >= 100000)
|
||||
plan = pg_plan_query(query, cursorOptions, params);
|
||||
#elif (PG_VERSION_NUM >= 90600)
|
||||
plan = pg_plan_query(query, into ? 0 : CURSOR_OPT_PARALLEL_OK, params);
|
||||
#else
|
||||
plan = pg_plan_query(query, 0, params);
|
||||
plan = pg_plan_query(query, into ? 0 : CURSOR_OPT_PARALLEL_OK, params);
|
||||
#endif
|
||||
|
||||
INSTR_TIME_SET_CURRENT(planduration);
|
||||
|
|
|
@ -1450,11 +1450,9 @@ MasterAggregateExpression(Aggref *originalAggregate,
|
|||
unionAggregate->args = list_make1(hllTargetEntry);
|
||||
unionAggregate->aggkind = AGGKIND_NORMAL;
|
||||
unionAggregate->aggfilter = NULL;
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
unionAggregate->aggtranstype = InvalidOid;
|
||||
unionAggregate->aggargtypes = list_make1_oid(unionAggregate->aggtype);
|
||||
unionAggregate->aggsplit = AGGSPLIT_SIMPLE;
|
||||
#endif
|
||||
|
||||
cardinalityExpression = makeNode(FuncExpr);
|
||||
cardinalityExpression->funcid = cardinalityFunctionId;
|
||||
|
@ -1515,11 +1513,9 @@ MasterAggregateExpression(Aggref *originalAggregate,
|
|||
newMasterAggregate->aggfnoid = sumFunctionId;
|
||||
newMasterAggregate->aggtype = masterReturnType;
|
||||
newMasterAggregate->aggfilter = NULL;
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
newMasterAggregate->aggtranstype = InvalidOid;
|
||||
newMasterAggregate->aggargtypes = list_make1_oid(newMasterAggregate->aggtype);
|
||||
newMasterAggregate->aggsplit = AGGSPLIT_SIMPLE;
|
||||
#endif
|
||||
|
||||
column = makeVar(masterTableId, walkerContext->columnId, workerReturnType,
|
||||
workerReturnTypeMod, workerCollationId, columnLevelsUp);
|
||||
|
@ -1585,11 +1581,9 @@ MasterAggregateExpression(Aggref *originalAggregate,
|
|||
newMasterAggregate->aggfnoid = aggregateFunctionId;
|
||||
newMasterAggregate->args = list_make1(arrayCatAggArgument);
|
||||
newMasterAggregate->aggfilter = NULL;
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
newMasterAggregate->aggtranstype = InvalidOid;
|
||||
newMasterAggregate->aggargtypes = list_make1_oid(ANYARRAYOID);
|
||||
newMasterAggregate->aggsplit = AGGSPLIT_SIMPLE;
|
||||
#endif
|
||||
|
||||
newMasterExpression = (Expr *) newMasterAggregate;
|
||||
}
|
||||
|
@ -1644,12 +1638,8 @@ MasterAggregateExpression(Aggref *originalAggregate,
|
|||
/* Run AggRefs through cost machinery to mark required fields sanely */
|
||||
memset(&aggregateCosts, 0, sizeof(aggregateCosts));
|
||||
|
||||
#if PG_VERSION_NUM >= 90600
|
||||
get_agg_clause_costs(NULL, (Node *) newMasterExpression, AGGSPLIT_SIMPLE,
|
||||
&aggregateCosts);
|
||||
#else
|
||||
count_agg_clauses(NULL, (Node *) newMasterExpression, &aggregateCosts);
|
||||
#endif
|
||||
|
||||
return newMasterExpression;
|
||||
}
|
||||
|
@ -1693,11 +1683,9 @@ MasterAverageExpression(Oid sumAggregateType, Oid countAggregateType,
|
|||
firstSum->aggtype = get_func_rettype(firstSum->aggfnoid);
|
||||
firstSum->args = list_make1(firstTargetEntry);
|
||||
firstSum->aggkind = AGGKIND_NORMAL;
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
firstSum->aggtranstype = InvalidOid;
|
||||
firstSum->aggargtypes = list_make1_oid(firstSum->aggtype);
|
||||
firstSum->aggsplit = AGGSPLIT_SIMPLE;
|
||||
#endif
|
||||
|
||||
/* create the second argument for sum(column2) */
|
||||
secondColumn = makeVar(masterTableId, (*columnId), countAggregateType,
|
||||
|
@ -1710,11 +1698,9 @@ MasterAverageExpression(Oid sumAggregateType, Oid countAggregateType,
|
|||
secondSum->aggtype = get_func_rettype(secondSum->aggfnoid);
|
||||
secondSum->args = list_make1(secondTargetEntry);
|
||||
secondSum->aggkind = AGGKIND_NORMAL;
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
secondSum->aggtranstype = InvalidOid;
|
||||
secondSum->aggargtypes = list_make1_oid(firstSum->aggtype);
|
||||
secondSum->aggsplit = AGGSPLIT_SIMPLE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Build the division operator between these two aggregates. This function
|
||||
|
@ -2090,20 +2076,16 @@ WorkerAggregateExpressionList(Aggref *originalAggregate,
|
|||
sumAggregate->aggfnoid = AggregateFunctionOid(sumAggregateName, argumentType);
|
||||
sumAggregate->aggtype = get_func_rettype(sumAggregate->aggfnoid);
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
sumAggregate->aggtranstype = InvalidOid;
|
||||
sumAggregate->aggargtypes = list_make1_oid(argumentType);
|
||||
sumAggregate->aggsplit = AGGSPLIT_SIMPLE;
|
||||
#endif
|
||||
|
||||
/* count has any input type */
|
||||
countAggregate->aggfnoid = AggregateFunctionOid(countAggregateName, ANYOID);
|
||||
countAggregate->aggtype = get_func_rettype(countAggregate->aggfnoid);
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
countAggregate->aggtranstype = InvalidOid;
|
||||
countAggregate->aggargtypes = list_make1_oid(argumentType);
|
||||
countAggregate->aggsplit = AGGSPLIT_SIMPLE;
|
||||
#endif
|
||||
|
||||
workerAggregateList = lappend(workerAggregateList, sumAggregate);
|
||||
workerAggregateList = lappend(workerAggregateList, countAggregate);
|
||||
|
@ -2122,12 +2104,8 @@ WorkerAggregateExpressionList(Aggref *originalAggregate,
|
|||
/* Run AggRefs through cost machinery to mark required fields sanely */
|
||||
memset(&aggregateCosts, 0, sizeof(aggregateCosts));
|
||||
|
||||
#if PG_VERSION_NUM >= 90600
|
||||
get_agg_clause_costs(NULL, (Node *) workerAggregateList, AGGSPLIT_SIMPLE,
|
||||
&aggregateCosts);
|
||||
#else
|
||||
count_agg_clauses(NULL, (Node *) workerAggregateList, &aggregateCosts);
|
||||
#endif
|
||||
|
||||
return workerAggregateList;
|
||||
}
|
||||
|
@ -2418,17 +2396,11 @@ ErrorIfContainsUnsupportedAggregate(MultiNode *logicalPlanNode)
|
|||
|
||||
List *targetList = extendedOpNode->targetList;
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
|
||||
/*
|
||||
* PVC_REJECT_PLACEHOLDERS is now implicit if PVC_INCLUDE_PLACEHOLDERS
|
||||
* isn't specified.
|
||||
* PVC_REJECT_PLACEHOLDERS is implicit if PVC_INCLUDE_PLACEHOLDERS isn't
|
||||
* specified.
|
||||
*/
|
||||
List *expressionList = pull_var_clause((Node *) targetList, PVC_INCLUDE_AGGREGATES);
|
||||
#else
|
||||
List *expressionList = pull_var_clause((Node *) targetList, PVC_INCLUDE_AGGREGATES,
|
||||
PVC_REJECT_PLACEHOLDERS);
|
||||
#endif
|
||||
|
||||
ListCell *expressionCell = NULL;
|
||||
foreach(expressionCell, expressionList)
|
||||
|
|
|
@ -2769,17 +2769,11 @@ ExtractRangeTableEntryWalker(Node *node, List **rangeTableList)
|
|||
List *
|
||||
pull_var_clause_default(Node *node)
|
||||
{
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
|
||||
/*
|
||||
* PVC_REJECT_PLACEHOLDERS is now implicit if PVC_INCLUDE_PLACEHOLDERS
|
||||
* PVC_REJECT_PLACEHOLDERS is implicit if PVC_INCLUDE_PLACEHOLDERS
|
||||
* isn't specified.
|
||||
*/
|
||||
List *columnList = pull_var_clause(node, PVC_RECURSE_AGGREGATES);
|
||||
#else
|
||||
List *columnList = pull_var_clause(node, PVC_RECURSE_AGGREGATES,
|
||||
PVC_REJECT_PLACEHOLDERS);
|
||||
#endif
|
||||
|
||||
return columnList;
|
||||
}
|
||||
|
|
|
@ -99,14 +99,9 @@ BuildAggregatePlan(Query *masterQuery, Plan *subPlan)
|
|||
|
||||
/* estimate aggregate execution costs */
|
||||
memset(&aggregateCosts, 0, sizeof(AggClauseCosts));
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
get_agg_clause_costs(NULL, (Node *) aggregateTargetList, AGGSPLIT_SIMPLE,
|
||||
&aggregateCosts);
|
||||
get_agg_clause_costs(NULL, (Node *) havingQual, AGGSPLIT_SIMPLE, &aggregateCosts);
|
||||
#else
|
||||
count_agg_clauses(NULL, (Node *) aggregateTargetList, &aggregateCosts);
|
||||
count_agg_clauses(NULL, (Node *) havingQual, &aggregateCosts);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For upper level plans above the sequential scan, the planner expects the
|
||||
|
@ -142,17 +137,10 @@ BuildAggregatePlan(Query *masterQuery, Plan *subPlan)
|
|||
}
|
||||
|
||||
/* finally create the plan */
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
aggregatePlan = make_agg(aggregateTargetList, (List *) havingQual, aggregateStrategy,
|
||||
AGGSPLIT_SIMPLE, groupColumnCount, groupColumnIdArray,
|
||||
groupColumnOpArray, NIL, NIL,
|
||||
rowEstimate, subPlan);
|
||||
#else
|
||||
aggregatePlan = make_agg(NULL, aggregateTargetList, (List *) havingQual,
|
||||
aggregateStrategy,
|
||||
&aggregateCosts, groupColumnCount, groupColumnIdArray,
|
||||
groupColumnOpArray, NIL, rowEstimate, subPlan);
|
||||
#endif
|
||||
|
||||
/* just for reproducible costs between different PostgreSQL versions */
|
||||
aggregatePlan->plan.startup_cost = 0;
|
||||
|
@ -219,11 +207,7 @@ BuildSelectStatement(Query *masterQuery, List *masterTargetList, CustomScan *rem
|
|||
if (masterQuery->sortClause)
|
||||
{
|
||||
List *sortClauseList = masterQuery->sortClause;
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
Sort *sortPlan = make_sort_from_sortclauses(sortClauseList, topLevelPlan);
|
||||
#else
|
||||
Sort *sortPlan = make_sort_from_sortclauses(NULL, sortClauseList, topLevelPlan);
|
||||
#endif
|
||||
|
||||
/* just for reproducible costs between different PostgreSQL versions */
|
||||
sortPlan->plan.startup_cost = 0;
|
||||
|
@ -238,15 +222,7 @@ BuildSelectStatement(Query *masterQuery, List *masterTargetList, CustomScan *rem
|
|||
{
|
||||
Node *limitCount = masterQuery->limitCount;
|
||||
Node *limitOffset = masterQuery->limitOffset;
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
Limit *limitPlan = make_limit(topLevelPlan, limitOffset, limitCount);
|
||||
#else
|
||||
int64 offsetEstimate = 0;
|
||||
int64 countEstimate = 0;
|
||||
|
||||
Limit *limitPlan = make_limit(topLevelPlan, limitOffset, limitCount,
|
||||
offsetEstimate, countEstimate);
|
||||
#endif
|
||||
topLevelPlan = (Plan *) limitPlan;
|
||||
}
|
||||
|
||||
|
|
|
@ -2804,14 +2804,8 @@ ReorderInsertSelectTargetLists(Query *originalQuery, RangeTblEntry *insertRte,
|
|||
* It is safe to pull Var clause and ignore the coercions since that
|
||||
* are already going to be added on the workers implicitly.
|
||||
*/
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
targetVarList = pull_var_clause((Node *) oldInsertTargetEntry->expr,
|
||||
PVC_RECURSE_AGGREGATES);
|
||||
#else
|
||||
targetVarList = pull_var_clause((Node *) oldInsertTargetEntry->expr,
|
||||
PVC_RECURSE_AGGREGATES,
|
||||
PVC_RECURSE_PLACEHOLDERS);
|
||||
#endif
|
||||
|
||||
targetVarCount = list_length(targetVarList);
|
||||
|
||||
|
|
|
@ -89,15 +89,9 @@ FakeGetForeignPaths(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid)
|
|||
Cost startup_cost = 0;
|
||||
Cost total_cost = startup_cost + baserel->rows;
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
add_path(baserel, (Path *) create_foreignscan_path(root, baserel, NULL, baserel->rows,
|
||||
startup_cost, total_cost, NIL,
|
||||
NULL, NULL, NIL));
|
||||
#else
|
||||
add_path(baserel, (Path *) create_foreignscan_path(root, baserel, baserel->rows,
|
||||
startup_cost, total_cost, NIL,
|
||||
NULL, NULL, NIL));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -339,8 +339,6 @@ citus_extradata_container(PG_FUNCTION_ARGS)
|
|||
}
|
||||
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
|
||||
static void
|
||||
CopyUnsupportedCitusNode(struct ExtensibleNode *newnode,
|
||||
const struct ExtensibleNode *oldnode)
|
||||
|
@ -403,12 +401,10 @@ const ExtensibleNodeMethods nodeMethods[] =
|
|||
DEFINE_NODE_METHODS_NO_READ(MultiCartesianProduct),
|
||||
DEFINE_NODE_METHODS_NO_READ(MultiExtendedOp)
|
||||
};
|
||||
#endif
|
||||
|
||||
void
|
||||
RegisterNodes(void)
|
||||
{
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
int off;
|
||||
|
||||
StaticAssertExpr(lengthof(nodeMethods) == lengthof(CitusNodeTagNamesD),
|
||||
|
@ -418,5 +414,4 @@ RegisterNodes(void)
|
|||
{
|
||||
RegisterExtensibleNodeMethods(&nodeMethods[off]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -45,16 +45,9 @@
|
|||
const nodeTypeName *node = (const nodeTypeName *) raw_node
|
||||
|
||||
/* Write the label for the node type */
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
#define WRITE_NODE_TYPE(nodelabel) \
|
||||
(void) 0
|
||||
|
||||
#else
|
||||
#define WRITE_NODE_TYPE(nodelabel) \
|
||||
appendStringInfoString(str, nodelabel)
|
||||
|
||||
#endif
|
||||
|
||||
/* Write an integer field (anything written as ":fldname %d") */
|
||||
#define WRITE_INT_FIELD(fldname) \
|
||||
appendStringInfo(str, " :" CppAsString(fldname) " %d", node->fldname)
|
||||
|
@ -115,123 +108,6 @@
|
|||
|
||||
#define booltostr(x) ((x) ? "true" : "false")
|
||||
|
||||
#if (PG_VERSION_NUM < 90600)
|
||||
static void outNode(StringInfo str, const void *obj);
|
||||
|
||||
/*
|
||||
* outToken
|
||||
* Convert an ordinary string (eg, an identifier) into a form that
|
||||
* will be decoded back to a plain token by read.c's functions.
|
||||
*
|
||||
* If a null or empty string is given, it is encoded as "<>".
|
||||
*/
|
||||
static void
|
||||
outToken(StringInfo str, const char *s)
|
||||
{
|
||||
if (s == NULL || *s == '\0')
|
||||
{
|
||||
appendStringInfoString(str, "<>");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Look for characters or patterns that are treated specially by read.c
|
||||
* (either in pg_strtok() or in nodeRead()), and therefore need a
|
||||
* protective backslash.
|
||||
*/
|
||||
/* These characters only need to be quoted at the start of the string */
|
||||
if (*s == '<' ||
|
||||
*s == '\"' ||
|
||||
isdigit((unsigned char) *s) ||
|
||||
((*s == '+' || *s == '-') &&
|
||||
(isdigit((unsigned char) s[1]) || s[1] == '.')))
|
||||
appendStringInfoChar(str, '\\');
|
||||
while (*s)
|
||||
{
|
||||
/* These chars must be backslashed anywhere in the string */
|
||||
if (*s == ' ' || *s == '\n' || *s == '\t' ||
|
||||
*s == '(' || *s == ')' || *s == '{' || *s == '}' ||
|
||||
*s == '\\')
|
||||
appendStringInfoChar(str, '\\');
|
||||
appendStringInfoChar(str, *s++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_outList(StringInfo str, const List *node)
|
||||
{
|
||||
const ListCell *lc;
|
||||
|
||||
appendStringInfoChar(str, '(');
|
||||
|
||||
if (IsA(node, IntList))
|
||||
appendStringInfoChar(str, 'i');
|
||||
else if (IsA(node, OidList))
|
||||
appendStringInfoChar(str, 'o');
|
||||
|
||||
foreach(lc, node)
|
||||
{
|
||||
/*
|
||||
* For the sake of backward compatibility, we emit a slightly
|
||||
* different whitespace format for lists of nodes vs. other types of
|
||||
* lists. XXX: is this necessary?
|
||||
*/
|
||||
if (IsA(node, List))
|
||||
{
|
||||
outNode(str, lfirst(lc));
|
||||
if (lnext(lc))
|
||||
appendStringInfoChar(str, ' ');
|
||||
}
|
||||
else if (IsA(node, IntList))
|
||||
appendStringInfo(str, " %d", lfirst_int(lc));
|
||||
else if (IsA(node, OidList))
|
||||
appendStringInfo(str, " %u", lfirst_oid(lc));
|
||||
else
|
||||
elog(ERROR, "unrecognized list node type: %d",
|
||||
(int) node->type);
|
||||
}
|
||||
|
||||
appendStringInfoChar(str, ')');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print the value of a Datum given its type.
|
||||
*/
|
||||
static void
|
||||
outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
|
||||
{
|
||||
Size length,
|
||||
i;
|
||||
char *s;
|
||||
|
||||
length = datumGetSize(value, typbyval, typlen);
|
||||
|
||||
if (typbyval)
|
||||
{
|
||||
s = (char *) (&value);
|
||||
appendStringInfo(str, "%u [ ", (unsigned int) length);
|
||||
for (i = 0; i < (Size) sizeof(Datum); i++)
|
||||
appendStringInfo(str, "%d ", (int) (s[i]));
|
||||
appendStringInfoChar(str, ']');
|
||||
}
|
||||
else
|
||||
{
|
||||
s = (char *) DatumGetPointer(value);
|
||||
if (!PointerIsValid(s))
|
||||
appendStringInfoString(str, "0 [ ]");
|
||||
else
|
||||
{
|
||||
appendStringInfo(str, "%u [ ", (unsigned int) length);
|
||||
for (i = 0; i < length; i++)
|
||||
appendStringInfo(str, "%d ", (int) (s[i]));
|
||||
appendStringInfoChar(str, ']');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* Output routines for Citus node types
|
||||
|
@ -542,140 +418,6 @@ OutDeferredErrorMessage(OUTFUNC_ARGS)
|
|||
}
|
||||
|
||||
|
||||
#if (PG_VERSION_NUM < 90600)
|
||||
|
||||
/*
|
||||
* outNode -
|
||||
* converts a Node into ascii string and append it to 'str'
|
||||
*/
|
||||
static void
|
||||
outNode(StringInfo str, const void *obj)
|
||||
{
|
||||
if (obj == NULL)
|
||||
{
|
||||
appendStringInfoString(str, "<>");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (CitusNodeTag(obj))
|
||||
{
|
||||
case T_List:
|
||||
case T_IntList:
|
||||
case T_OidList:
|
||||
_outList(str, obj);
|
||||
break;
|
||||
|
||||
case T_MultiTreeRoot:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiTreeRoot(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MultiProject:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiProject(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MultiCollect:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiCollect(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MultiSelect:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiSelect(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MultiTable:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiTable(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MultiJoin:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiJoin(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MultiPartition:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiPartition(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MultiCartesianProduct:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiCartesianProduct(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MultiExtendedOp:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiExtendedOp(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_Job:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutJob(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MapMergeJob:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMapMergeJob(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_MultiPlan:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutMultiPlan(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_Task:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutTask(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_ShardInterval:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutShardInterval(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_ShardPlacement:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutShardPlacement(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_RelationShard:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutRelationShard(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
case T_DeferredErrorMessage:
|
||||
appendStringInfoChar(str, '{');
|
||||
OutDeferredErrorMessage(str, obj);
|
||||
appendStringInfoChar(str, '}');
|
||||
break;
|
||||
|
||||
default:
|
||||
/* fall back into postgres' normal nodeToString machinery */
|
||||
appendStringInfoString(str, nodeToString(obj));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CitusNodeToString -
|
||||
* returns the ascii representation of the Node as a palloc'd string
|
||||
|
@ -683,13 +425,5 @@ outNode(StringInfo str, const void *obj)
|
|||
char *
|
||||
CitusNodeToString(const void *obj)
|
||||
{
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
return nodeToString(obj);
|
||||
#else
|
||||
StringInfoData str;
|
||||
|
||||
initStringInfo(&str);
|
||||
outNode(&str, obj);
|
||||
return str.data;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
* to copy various routines anymore. In that case, replace these functions
|
||||
* with plain wrappers.
|
||||
*/
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
|
||||
void *
|
||||
CitusStringToNode(char *str)
|
||||
{
|
||||
|
@ -55,325 +53,3 @@ CitusNodeRead(char *token, int tok_len)
|
|||
{
|
||||
return nodeRead(token, tok_len);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Static state for citus_pg_strtok */
|
||||
static char *citus_pg_strtok_ptr = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* CitusStringToNode -
|
||||
* returns a Node with a given legal ASCII representation
|
||||
*/
|
||||
void *
|
||||
CitusStringToNode(char *str)
|
||||
{
|
||||
char *save_strtok;
|
||||
void *retval;
|
||||
|
||||
/*
|
||||
* We save and restore the pre-existing state of citus_pg_strtok. This makes the
|
||||
* world safe for re-entrant invocation of stringToNode, without incurring
|
||||
* a lot of notational overhead by having to pass the next-character
|
||||
* pointer around through all the readfuncs.c code.
|
||||
*/
|
||||
save_strtok = citus_pg_strtok_ptr;
|
||||
|
||||
citus_pg_strtok_ptr = str; /* point citus_pg_strtok at the string to read */
|
||||
|
||||
retval = CitusNodeRead(NULL, 0); /* do the reading */
|
||||
|
||||
citus_pg_strtok_ptr = save_strtok;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* citus_pg_strtok is a copy of postgres' pg_strtok routine, referencing
|
||||
* citus_pg_strtok_ptr instead of pg_strtok_ptr as state.
|
||||
*/
|
||||
char *
|
||||
citus_pg_strtok(int *length)
|
||||
{
|
||||
char *local_str; /* working pointer to string */
|
||||
char *ret_str; /* start of token to return */
|
||||
|
||||
local_str = citus_pg_strtok_ptr;
|
||||
|
||||
while (*local_str == ' ' || *local_str == '\n' || *local_str == '\t')
|
||||
local_str++;
|
||||
|
||||
if (*local_str == '\0')
|
||||
{
|
||||
*length = 0;
|
||||
citus_pg_strtok_ptr = local_str;
|
||||
return NULL; /* no more tokens */
|
||||
}
|
||||
|
||||
/*
|
||||
* Now pointing at start of next token.
|
||||
*/
|
||||
ret_str = local_str;
|
||||
|
||||
if (*local_str == '(' || *local_str == ')' ||
|
||||
*local_str == '{' || *local_str == '}')
|
||||
{
|
||||
/* special 1-character token */
|
||||
local_str++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Normal token, possibly containing backslashes */
|
||||
while (*local_str != '\0' &&
|
||||
*local_str != ' ' && *local_str != '\n' &&
|
||||
*local_str != '\t' &&
|
||||
*local_str != '(' && *local_str != ')' &&
|
||||
*local_str != '{' && *local_str != '}')
|
||||
{
|
||||
if (*local_str == '\\' && local_str[1] != '\0')
|
||||
local_str += 2;
|
||||
else
|
||||
local_str++;
|
||||
}
|
||||
}
|
||||
|
||||
*length = local_str - ret_str;
|
||||
|
||||
/* Recognize special case for "empty" token */
|
||||
if (*length == 2 && ret_str[0] == '<' && ret_str[1] == '>')
|
||||
*length = 0;
|
||||
|
||||
citus_pg_strtok_ptr = local_str;
|
||||
|
||||
return ret_str;
|
||||
}
|
||||
|
||||
#define RIGHT_PAREN (1000000 + 1)
|
||||
#define LEFT_PAREN (1000000 + 2)
|
||||
#define LEFT_BRACE (1000000 + 3)
|
||||
#define OTHER_TOKEN (1000000 + 4)
|
||||
|
||||
/*
|
||||
* nodeTokenType -
|
||||
* returns the type of the node token contained in token.
|
||||
* It returns one of the following valid NodeTags:
|
||||
* T_Integer, T_Float, T_String, T_BitString
|
||||
* and some of its own:
|
||||
* RIGHT_PAREN, LEFT_PAREN, LEFT_BRACE, OTHER_TOKEN
|
||||
*
|
||||
* Assumption: the ascii representation is legal
|
||||
*/
|
||||
static NodeTag
|
||||
nodeTokenType(char *token, int length)
|
||||
{
|
||||
NodeTag retval;
|
||||
char *numptr;
|
||||
int numlen;
|
||||
|
||||
/*
|
||||
* Check if the token is a number
|
||||
*/
|
||||
numptr = token;
|
||||
numlen = length;
|
||||
if (*numptr == '+' || *numptr == '-')
|
||||
numptr++, numlen--;
|
||||
if ((numlen > 0 && isdigit((unsigned char) *numptr)) ||
|
||||
(numlen > 1 && *numptr == '.' && isdigit((unsigned char) numptr[1])))
|
||||
{
|
||||
/*
|
||||
* Yes. Figure out whether it is integral or float; this requires
|
||||
* both a syntax check and a range check. strtol() can do both for us.
|
||||
* We know the token will end at a character that strtol will stop at,
|
||||
* so we do not need to modify the string.
|
||||
*/
|
||||
long val;
|
||||
char *endptr;
|
||||
|
||||
errno = 0;
|
||||
val = strtol(token, &endptr, 10);
|
||||
(void) val; /* avoid compiler warning if unused */
|
||||
if (endptr != token + length || errno == ERANGE
|
||||
#ifdef HAVE_LONG_INT_64
|
||||
/* if long > 32 bits, check for overflow of int4 */
|
||||
|| val != (long) ((int32) val)
|
||||
#endif
|
||||
)
|
||||
return T_Float;
|
||||
return T_Integer;
|
||||
}
|
||||
|
||||
/*
|
||||
* these three cases do not need length checks, since citus_pg_strtok() will
|
||||
* always treat them as single-byte tokens
|
||||
*/
|
||||
else if (*token == '(')
|
||||
retval = LEFT_PAREN;
|
||||
else if (*token == ')')
|
||||
retval = RIGHT_PAREN;
|
||||
else if (*token == '{')
|
||||
retval = LEFT_BRACE;
|
||||
else if (*token == '\"' && length > 1 && token[length - 1] == '\"')
|
||||
retval = T_String;
|
||||
else if (*token == 'b')
|
||||
retval = T_BitString;
|
||||
else
|
||||
retval = OTHER_TOKEN;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CitusNodeRead is an adapted copy of postgres' nodeRead routine, using
|
||||
* citus_pg_strtok_ptr instead of pg_strtok_ptr.
|
||||
*/
|
||||
void *
|
||||
CitusNodeRead(char *token, int tok_len)
|
||||
{
|
||||
Node *result;
|
||||
NodeTag type;
|
||||
|
||||
if (token == NULL) /* need to read a token? */
|
||||
{
|
||||
token = citus_pg_strtok(&tok_len);
|
||||
|
||||
if (token == NULL) /* end of input */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
type = nodeTokenType(token, tok_len);
|
||||
|
||||
switch ((int) type)
|
||||
{
|
||||
case LEFT_BRACE:
|
||||
result = CitusParseNodeString();
|
||||
token = citus_pg_strtok(&tok_len);
|
||||
if (token == NULL || token[0] != '}')
|
||||
elog(ERROR, "did not find '}' at end of input node");
|
||||
break;
|
||||
case LEFT_PAREN:
|
||||
{
|
||||
List *l = NIL;
|
||||
|
||||
/*----------
|
||||
* Could be an integer list: (i int int ...)
|
||||
* or an OID list: (o int int ...)
|
||||
* or a list of nodes/values: (node node ...)
|
||||
*----------
|
||||
*/
|
||||
token = citus_pg_strtok(&tok_len);
|
||||
if (token == NULL)
|
||||
elog(ERROR, "unterminated List structure");
|
||||
if (tok_len == 1 && token[0] == 'i')
|
||||
{
|
||||
/* List of integers */
|
||||
for (;;)
|
||||
{
|
||||
int val;
|
||||
char *endptr;
|
||||
|
||||
token = citus_pg_strtok(&tok_len);
|
||||
if (token == NULL)
|
||||
elog(ERROR, "unterminated List structure");
|
||||
if (token[0] == ')')
|
||||
break;
|
||||
val = (int) strtol(token, &endptr, 10);
|
||||
if (endptr != token + tok_len)
|
||||
elog(ERROR, "unrecognized integer: \"%.*s\"",
|
||||
tok_len, token);
|
||||
l = lappend_int(l, val);
|
||||
}
|
||||
}
|
||||
else if (tok_len == 1 && token[0] == 'o')
|
||||
{
|
||||
/* List of OIDs */
|
||||
for (;;)
|
||||
{
|
||||
Oid val;
|
||||
char *endptr;
|
||||
|
||||
token = citus_pg_strtok(&tok_len);
|
||||
if (token == NULL)
|
||||
elog(ERROR, "unterminated List structure");
|
||||
if (token[0] == ')')
|
||||
break;
|
||||
val = (Oid) strtoul(token, &endptr, 10);
|
||||
if (endptr != token + tok_len)
|
||||
elog(ERROR, "unrecognized OID: \"%.*s\"",
|
||||
tok_len, token);
|
||||
l = lappend_oid(l, val);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* List of other node types */
|
||||
for (;;)
|
||||
{
|
||||
/* We have already scanned next token... */
|
||||
if (token[0] == ')')
|
||||
break;
|
||||
l = lappend(l, CitusNodeRead(token, tok_len));
|
||||
token = citus_pg_strtok(&tok_len);
|
||||
if (token == NULL)
|
||||
elog(ERROR, "unterminated List structure");
|
||||
}
|
||||
}
|
||||
result = (Node *) l;
|
||||
break;
|
||||
}
|
||||
case RIGHT_PAREN:
|
||||
elog(ERROR, "unexpected right parenthesis");
|
||||
result = NULL; /* keep compiler happy */
|
||||
break;
|
||||
case OTHER_TOKEN:
|
||||
if (tok_len == 0)
|
||||
{
|
||||
/* must be "<>" --- represents a null pointer */
|
||||
result = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "unrecognized token: \"%.*s\"", tok_len, token);
|
||||
result = NULL; /* keep compiler happy */
|
||||
}
|
||||
break;
|
||||
case T_Integer:
|
||||
|
||||
/*
|
||||
* we know that the token terminates on a char atol will stop at
|
||||
*/
|
||||
result = (Node *) makeInteger(atol(token));
|
||||
break;
|
||||
case T_Float:
|
||||
{
|
||||
char *fval = (char *) palloc(tok_len + 1);
|
||||
|
||||
memcpy(fval, token, tok_len);
|
||||
fval[tok_len] = '\0';
|
||||
result = (Node *) makeFloat(fval);
|
||||
}
|
||||
break;
|
||||
case T_String:
|
||||
/* need to remove leading and trailing quotes, and backslashes */
|
||||
result = (Node *) makeString(debackslash(token + 1, tok_len - 2));
|
||||
break;
|
||||
case T_BitString:
|
||||
{
|
||||
char *val = palloc(tok_len);
|
||||
|
||||
/* skip leading 'b' */
|
||||
memcpy(val, token + 1, tok_len - 1);
|
||||
val[tok_len - 1] = '\0';
|
||||
result = (Node *) makeBitString(val);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d", (int) type);
|
||||
result = NULL; /* keep compiler happy */
|
||||
break;
|
||||
}
|
||||
|
||||
return (void *) result;
|
||||
}
|
||||
|
||||
#endif /* (PG_VERSION_NUM < 90600) */
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
/* Macros for declaring appropriate local variables */
|
||||
/* A few guys need only local_node */
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
static inline Node *
|
||||
CitusSetTag(Node *node, int tag)
|
||||
{
|
||||
|
@ -42,10 +41,6 @@ CitusSetTag(Node *node, int tag)
|
|||
/* *INDENT-OFF* */
|
||||
#define READ_LOCALS_NO_FIELDS(nodeTypeName) \
|
||||
nodeTypeName *local_node = (nodeTypeName *) CitusSetTag((Node *) node, T_##nodeTypeName)
|
||||
#else
|
||||
#define READ_LOCALS_NO_FIELDS(nodeTypeName) \
|
||||
nodeTypeName *local_node = CitusMakeNode(nodeTypeName)
|
||||
#endif
|
||||
|
||||
/* And a few guys need only the citus_pg_strtok support fields */
|
||||
#define READ_TEMP_LOCALS() \
|
||||
|
@ -125,14 +120,8 @@ CitusSetTag(Node *node, int tag)
|
|||
local_node->fldname = CitusNodeRead(NULL, 0)
|
||||
|
||||
/* Routine exit */
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
#define READ_DONE() \
|
||||
return;
|
||||
#else
|
||||
#define READ_DONE() \
|
||||
return (Node *) local_node
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: use atoi() to read values written with %d, or atoui() to read
|
||||
|
@ -349,75 +338,9 @@ ReadUnsupportedCitusNode(READFUNC_ARGS)
|
|||
}
|
||||
|
||||
|
||||
#if (PG_VERSION_NUM < 90600)
|
||||
|
||||
/*
|
||||
* readDatum
|
||||
*
|
||||
* Given a string representation of a constant, recreate the appropriate
|
||||
* Datum. The string representation embeds length info, but not byValue,
|
||||
* so we must be told that.
|
||||
*/
|
||||
Datum
|
||||
readDatum(bool typbyval)
|
||||
{
|
||||
Size length,
|
||||
i;
|
||||
int tokenLength;
|
||||
char *token;
|
||||
Datum res;
|
||||
char *s;
|
||||
|
||||
/*
|
||||
* read the actual length of the value
|
||||
*/
|
||||
token = citus_pg_strtok(&tokenLength);
|
||||
length = atoui(token);
|
||||
|
||||
token = citus_pg_strtok(&tokenLength); /* read the '[' */
|
||||
if (token == NULL || token[0] != '[')
|
||||
elog(ERROR, "expected \"[\" to start datum, but got \"%s\"; length = %zu",
|
||||
token ? (const char *) token : "[NULL]", length);
|
||||
|
||||
if (typbyval)
|
||||
{
|
||||
if (length > (Size) sizeof(Datum))
|
||||
elog(ERROR, "byval datum but length = %zu", length);
|
||||
res = (Datum) 0;
|
||||
s = (char *) (&res);
|
||||
for (i = 0; i < (Size) sizeof(Datum); i++)
|
||||
{
|
||||
token = citus_pg_strtok(&tokenLength);
|
||||
s[i] = (char) atoi(token);
|
||||
}
|
||||
}
|
||||
else if (length <= 0)
|
||||
res = (Datum) NULL;
|
||||
else
|
||||
{
|
||||
s = (char *) palloc(length);
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
token = citus_pg_strtok(&tokenLength);
|
||||
s[i] = (char) atoi(token);
|
||||
}
|
||||
res = PointerGetDatum(s);
|
||||
}
|
||||
|
||||
token = citus_pg_strtok(&tokenLength); /* read the ']' */
|
||||
if (token == NULL || token[0] != ']')
|
||||
elog(ERROR, "expected \"]\" to end datum, but got \"%s\"; length = %zu",
|
||||
token ? (const char *) token : "[NULL]", length);
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
|
||||
/*
|
||||
* For 9.6+ we can just use the, now extensible, parseNodeString(). Before
|
||||
* that citus_readfuncs_$ver.c has a version specific implementation.
|
||||
|
@ -427,6 +350,3 @@ CitusParseNodeString(void)
|
|||
{
|
||||
return parseNodeString();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,11 +14,7 @@
|
|||
#include "access/htup.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/skey.h"
|
||||
#if (PG_VERSION_NUM >= 90500 && PG_VERSION_NUM < 90600)
|
||||
#include "access/stratnum.h"
|
||||
#else
|
||||
#include "access/skey.h"
|
||||
#endif
|
||||
#include "access/tupmacs.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/indexing.h"
|
||||
|
|
|
@ -37,7 +37,6 @@ extern void * CitusNodeRead(char *token, int tok_len);
|
|||
|
||||
/* citus_readfuncs.c */
|
||||
extern Node * CitusParseNodeString(void);
|
||||
extern Datum readDatum(bool typbyval);
|
||||
|
||||
extern void RegisterNodes(void);
|
||||
|
||||
|
@ -47,19 +46,10 @@ extern void RegisterNodes(void);
|
|||
* different from before.
|
||||
*/
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
#define READFUNC_ARGS struct ExtensibleNode *node
|
||||
#define READFUNC_RET void
|
||||
#else
|
||||
#define READFUNC_ARGS void
|
||||
#define READFUNC_RET Node *
|
||||
#endif
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
#define OUTFUNC_ARGS StringInfo str, const struct ExtensibleNode *raw_node
|
||||
#else
|
||||
#define OUTFUNC_ARGS StringInfo str, const Node *raw_node
|
||||
#endif
|
||||
|
||||
extern READFUNC_RET ReadJob(READFUNC_ARGS);
|
||||
extern READFUNC_RET ReadMultiPlan(READFUNC_ARGS);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#ifndef CITUS_NODES_H
|
||||
#define CITUS_NODES_H
|
||||
|
||||
#include "nodes/extensible.h"
|
||||
|
||||
/*
|
||||
* Citus Node Tags
|
||||
|
@ -63,9 +64,6 @@ typedef enum CitusNodeTag
|
|||
|
||||
const char** CitusNodeTagNames;
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
|
||||
#include "nodes/extensible.h"
|
||||
|
||||
typedef struct CitusNode
|
||||
{
|
||||
|
@ -98,30 +96,6 @@ CitusNodeTagI(Node *node)
|
|||
})
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#include "nodes/nodes.h"
|
||||
|
||||
typedef CitusNodeTag CitusNode;
|
||||
/*
|
||||
* nodeTag equivalent that returns the node tag for both citus and postgres
|
||||
* node tag types. Needs to return int as there's no type that covers both
|
||||
* postgres and citus node values.
|
||||
*/
|
||||
#define CitusNodeTag(nodeptr) (*((const int*)(nodeptr)))
|
||||
|
||||
|
||||
/* Citus variant of newNode(), don't use directly. */
|
||||
#define CitusNewNode(size, tag) \
|
||||
({ Node *_result; \
|
||||
AssertMacro((size) >= sizeof(Node)); /* need the tag, at least */ \
|
||||
_result = (Node *) palloc0fast(size); \
|
||||
_result->type = (int) (tag); \
|
||||
_result; \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IsA equivalent that compares node tags, including Citus-specific nodes.
|
||||
*/
|
||||
|
|
|
@ -18,13 +18,6 @@
|
|||
#include "distributed/multi_server_executor.h"
|
||||
|
||||
|
||||
#if (PG_VERSION_NUM >= 90600)
|
||||
#define tuplecount_t uint64
|
||||
#else
|
||||
#define tuplecount_t long
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct CitusScanState
|
||||
{
|
||||
CustomScanState customScanState; /* underlying custom scan node */
|
||||
|
|
Loading…
Reference in New Issue