static void
copytup_index(Tuplesortstate *state, SortTuple *stup, void *tup)
{
- IndexTuple tuple = (IndexTuple) tup;
- unsigned int tuplen = IndexTupleSize(tuple);
- IndexTuple newtuple;
- Datum original;
-
- /* copy the tuple into sort storage */
- newtuple = (IndexTuple) MemoryContextAlloc(state->tuplecontext, tuplen);
- memcpy(newtuple, tuple, tuplen);
- USEMEM(state, GetMemoryChunkSpace(newtuple));
- stup->tuple = (void *) newtuple;
- /* set up first-column key value */
- original = index_getattr(newtuple,
- 1,
- RelationGetDescr(state->indexRel),
- &stup->isnull1);
-
- if (!state->sortKeys->abbrev_converter || stup->isnull1)
- {
- /*
- * Store ordinary Datum representation, or NULL value. If there is a
- * converter it won't expect NULL values, and cost model is not
- * required to account for NULL, so in that case we avoid calling
- * converter and just set datum1 to zeroed representation (to be
- * consistent, and to support cheap inequality tests for NULL
- * abbreviated keys).
- */
- stup->datum1 = original;
- }
- else if (!consider_abort_common(state))
- {
- /* Store abbreviated key representation */
- stup->datum1 = state->sortKeys->abbrev_converter(original,
- state->sortKeys);
- }
- else
- {
- /* Abort abbreviation */
- int i;
-
- stup->datum1 = original;
-
- /*
- * Set state to be consistent with never trying abbreviation.
- *
- * Alter datum1 representation in already-copied tuples, so as to
- * ensure a consistent representation (current tuple was just
- * handled). It does not matter if some dumped tuples are already
- * sorted on tape, since serialized tuples lack abbreviated keys
- * (TSS_BUILDRUNS state prevents control reaching here in any case).
- */
- for (i = 0; i < state->memtupcount; i++)
- {
- SortTuple *mtup = &state->memtuples[i];
-
- tuple = (IndexTuple) mtup->tuple;
- mtup->datum1 = index_getattr(tuple,
- 1,
- RelationGetDescr(state->indexRel),
- &mtup->isnull1);
- }
- }
+ /* Not currently needed */
+ elog(ERROR, "copytup_index() should not be called");
}
static void