Update MakeSingleTupleTableSlotCompat to take 2nd param

This gets us past CREATE EXTENSION, but citus--5.0 uses WITH OIDS
read_write_etc
Philip Dubé 2019-07-13 00:32:20 +00:00
parent 8c67ed352c
commit 5fd79ff82b
10 changed files with 25 additions and 19 deletions

View File

@ -1237,7 +1237,7 @@ CopyLocalDataIntoShards(Oid distributedRelationId)
/* get the table columns */ /* get the table columns */
tupleDescriptor = RelationGetDescr(distributedRelation); tupleDescriptor = RelationGetDescr(distributedRelation);
slot = MakeSingleTupleTableSlotCompat(tupleDescriptor); slot = MakeSingleTupleTableSlotCompat(tupleDescriptor, &TTSOpsHeapTuple);
columnNameList = TupleDescColumnNameList(tupleDescriptor); columnNameList = TupleDescColumnNameList(tupleDescriptor);
/* determine the partition column in the tuple descriptor */ /* determine the partition column in the tuple descriptor */

View File

@ -463,7 +463,7 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
columnNulls = palloc0(columnCount * sizeof(bool)); columnNulls = palloc0(columnCount * sizeof(bool));
/* set up a virtual tuple table slot */ /* set up a virtual tuple table slot */
tupleTableSlot = MakeSingleTupleTableSlotCompat(tupleDescriptor); tupleTableSlot = MakeSingleTupleTableSlotCompat(tupleDescriptor, &TTSOpsVirtual);
tupleTableSlot->tts_nvalid = columnCount; tupleTableSlot->tts_nvalid = columnCount;
tupleTableSlot->tts_values = columnValues; tupleTableSlot->tts_values = columnValues;
tupleTableSlot->tts_isnull = columnNulls; tupleTableSlot->tts_isnull = columnNulls;

View File

@ -704,7 +704,8 @@ SortTupleStore(CitusScanState *scanState)
/* iterate over all the sorted tuples, add them to original tuplestore */ /* iterate over all the sorted tuples, add them to original tuplestore */
while (true) while (true)
{ {
TupleTableSlot *newSlot = MakeSingleTupleTableSlotCompat(tupleDescriptor); TupleTableSlot *newSlot = MakeSingleTupleTableSlotCompat(tupleDescriptor,
&TTSOpsMinimalTuple);
bool found = tuplesort_gettupleslot(tuplesortstate, true, false, newSlot, NULL); bool found = tuplesort_gettupleslot(tuplesortstate, true, false, newSlot, NULL);
if (!found) if (!found)

View File

@ -202,7 +202,7 @@ UpdateRelationToShardNames(Node *node, List *relationShardList)
if (IsA(node, Query)) if (IsA(node, Query))
{ {
return query_tree_walker((Query *) node, UpdateRelationToShardNames, return query_tree_walker((Query *) node, UpdateRelationToShardNames,
relationShardList, QTW_EXAMINE_RTES); relationShardList, QTW_EXAMINE_RTES_BEFORE);
} }
if (!IsA(node, RangeTblEntry)) if (!IsA(node, RangeTblEntry))

View File

@ -150,7 +150,7 @@ MultiLogicalPlanCreate(Query *originalQuery, Query *queryTree,
* FindNodeCheck finds a node for which the check function returns true. * FindNodeCheck finds a node for which the check function returns true.
* *
* To call this function directly with an RTE, use: * To call this function directly with an RTE, use:
* range_table_walker(rte, FindNodeCheck, check, QTW_EXAMINE_RTES) * range_table_walker(rte, FindNodeCheck, check, QTW_EXAMINE_RTES_BEFORE)
*/ */
bool bool
FindNodeCheck(Node *node, bool (*check)(Node *)) FindNodeCheck(Node *node, bool (*check)(Node *))
@ -172,7 +172,8 @@ FindNodeCheck(Node *node, bool (*check)(Node *))
} }
else if (IsA(node, Query)) else if (IsA(node, Query))
{ {
return query_tree_walker((Query *) node, FindNodeCheck, check, QTW_EXAMINE_RTES); return query_tree_walker((Query *) node, FindNodeCheck, check,
QTW_EXAMINE_RTES_BEFORE);
} }
return expression_tree_walker(node, FindNodeCheck, check); return expression_tree_walker(node, FindNodeCheck, check);
@ -380,7 +381,7 @@ AllTargetExpressionsAreColumnReferences(List *targetEntryList)
bool bool
FindNodeCheckInRangeTableList(List *rtable, bool (*check)(Node *)) FindNodeCheckInRangeTableList(List *rtable, bool (*check)(Node *))
{ {
return range_table_walker(rtable, FindNodeCheck, check, QTW_EXAMINE_RTES); return range_table_walker(rtable, FindNodeCheck, check, QTW_EXAMINE_RTES_BEFORE);
} }
@ -1992,7 +1993,8 @@ ExtractRangeTableRelationWalker(Node *node, List **rangeTableRelationList)
{ {
walkIsComplete = query_tree_walker((Query *) node, walkIsComplete = query_tree_walker((Query *) node,
ExtractRangeTableRelationWalker, ExtractRangeTableRelationWalker,
rangeTableRelationList, QTW_EXAMINE_RTES); rangeTableRelationList,
QTW_EXAMINE_RTES_BEFORE);
} }
else else
{ {
@ -2040,7 +2042,7 @@ ExtractRangeTableEntryWalker(Node *node, List **rangeTableList)
walkIsComplete = query_tree_walker((Query *) node, walkIsComplete = query_tree_walker((Query *) node,
ExtractRangeTableEntryWalker, ExtractRangeTableEntryWalker,
rangeTableList, rangeTableList,
QTW_EXAMINE_RTES); QTW_EXAMINE_RTES_BEFORE);
} }
else else
{ {
@ -2048,7 +2050,7 @@ ExtractRangeTableEntryWalker(Node *node, List **rangeTableList)
walkIsComplete = range_table_walker(query->rtable, walkIsComplete = range_table_walker(query->rtable,
ExtractRangeTableEntryWalker, ExtractRangeTableEntryWalker,
rangeTableList, rangeTableList,
QTW_EXAMINE_RTES); QTW_EXAMINE_RTES_BEFORE);
} }
} }
else else

View File

@ -1336,7 +1336,7 @@ static bool
IsRecurringRangeTable(List *rangeTable, RecurringTuplesType *recurType) IsRecurringRangeTable(List *rangeTable, RecurringTuplesType *recurType)
{ {
return range_table_walker(rangeTable, HasRecurringTuples, recurType, return range_table_walker(rangeTable, HasRecurringTuples, recurType,
QTW_EXAMINE_RTES); QTW_EXAMINE_RTES_BEFORE);
} }
@ -1411,7 +1411,7 @@ HasRecurringTuples(Node *node, RecurringTuplesType *recurType)
} }
return query_tree_walker((Query *) node, HasRecurringTuples, return query_tree_walker((Query *) node, HasRecurringTuples,
recurType, QTW_EXAMINE_RTES); recurType, QTW_EXAMINE_RTES_BEFORE);
} }
return expression_tree_walker(node, HasRecurringTuples, recurType); return expression_tree_walker(node, HasRecurringTuples, recurType);

View File

@ -1218,7 +1218,8 @@ CteReferenceListWalker(Node *node, CteReferenceWalkerContext *context)
Query *query = (Query *) node; Query *query = (Query *) node;
context->level += 1; context->level += 1;
query_tree_walker(query, CteReferenceListWalker, context, QTW_EXAMINE_RTES); query_tree_walker(query, CteReferenceListWalker, context,
QTW_EXAMINE_RTES_BEFORE);
context->level -= 1; context->level -= 1;
return false; return false;

View File

@ -156,7 +156,8 @@ ProgressMonitorList(uint64 commandTypeMagicNumber, List **attachedDSMSegments)
getProgressInfoFunctionOid, getProgressInfoFunctionOid,
commandTypeDatum); commandTypeDatum);
tupleTableSlot = MakeSingleTupleTableSlotCompat(progressResultSet->setDesc); tupleTableSlot = MakeSingleTupleTableSlotCompat(progressResultSet->setDesc,
&TTSOpsMinimalTuple);
/* iterate over tuples in tuple store, and send them to destination */ /* iterate over tuples in tuple store, and send them to destination */
for (;;) for (;;)

View File

@ -1641,7 +1641,8 @@ AvailableExtensionVersion(void)
/* pg_available_extensions returns result set containing all available extensions */ /* pg_available_extensions returns result set containing all available extensions */
(*pg_available_extensions)(fcinfo); (*pg_available_extensions)(fcinfo);
tupleTableSlot = MakeSingleTupleTableSlotCompat(extensionsResultSet->setDesc); tupleTableSlot = MakeSingleTupleTableSlotCompat(extensionsResultSet->setDesc,
&TTSOpsMinimalTuple);
hasTuple = tuplestore_gettupleslot(extensionsResultSet->setResult, goForward, doCopy, hasTuple = tuplestore_gettupleslot(extensionsResultSet->setResult, goForward, doCopy,
tupleTableSlot); tupleTableSlot);
while (hasTuple) while (hasTuple)

View File

@ -247,13 +247,11 @@ RangeVarGetRelidInternal(const RangeVar *relation, LOCKMODE lockmode, uint32 fla
#if PG_VERSION_NUM >= 120000 #if PG_VERSION_NUM >= 120000
#define NextCopyLastParam #define NextCopyLastParam
#define MakeSingleTupleTableSlotCompat(tupleDesc) \ #define MakeSingleTupleTableSlotCompat MakeSingleTupleTableSlot
MakeSingleTupleTableSlot(tupleDesc, &TTSOpsHeapTuple)
#define AllocSetContextCreateExtended AllocSetContextCreateInternal #define AllocSetContextCreateExtended AllocSetContextCreateInternal
#define ExecStoreTuple(tuple, slot, buffer, shouldFree) \ #define ExecStoreTuple(tuple, slot, buffer, shouldFree) \
ExecStoreHeapTuple(tuple, slot, shouldFree) ExecStoreHeapTuple(tuple, slot, shouldFree)
#define NextCopyFromCompat NextCopyFrom #define NextCopyFromCompat NextCopyFrom
#define QTW_EXAMINE_RTES QTW_EXAMINE_RTES_BEFORE
#define ArrayRef SubscriptingRef #define ArrayRef SubscriptingRef
#define T_ArrayRef T_SubscriptingRef #define T_ArrayRef T_SubscriptingRef
#define or_clause is_orclause #define or_clause is_orclause
@ -272,7 +270,9 @@ RangeVarGetRelidInternal(const RangeVar *relation, LOCKMODE lockmode, uint32 fla
#define InitFunctionCallInfoDataCompat InitFunctionCallInfoData #define InitFunctionCallInfoDataCompat InitFunctionCallInfoData
#else /* pre PG12 */ #else /* pre PG12 */
#define MakeSingleTupleTableSlotCompat MakeSingleTupleTableSlot #define QTW_EXAMINE_RTES_BEFORE QTW_EXAMINE_RTES
#define MakeSingleTupleTableSlotCompat(tupleDesc, tts_opts) \
MakeSingleTupleTableSlot(tupleDesc)
#define NextCopyFromCompat(cstate, econtext, values, nulls) \ #define NextCopyFromCompat(cstate, econtext, values, nulls) \
NextCopyFrom(cstate, econtext, values, nulls, NULL) NextCopyFrom(cstate, econtext, values, nulls, NULL)
#define GetSysCacheOid1Compat(cacheId, oidcol, key1) \ #define GetSysCacheOid1Compat(cacheId, oidcol, key1) \