mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
Remove unused code from tuplesort.
copytup_index() is unused, as tuplesort_putindextuplevalues() doesn't use COPYTUP(). Replace function body with an elog(ERROR), as already done e.g. for copytup_datum(). Author: Andres Freund Discussion: https://postgr.es/m/20191013144153.ooxrfglvnaocsrx2@alap3.anarazel.de
This commit is contained in:
parent
4a252996d5
commit
7d962eaf50
@ -4141,67 +4141,8 @@ comparetup_index_hash(const SortTuple *a, const SortTuple *b,
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user