Skip to content

Commit 7d962ea

Browse files
committed
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
1 parent 4a25299 commit 7d962ea

File tree

1 file changed

+2
-61
lines changed

1 file changed

+2
-61
lines changed

src/backend/utils/sort/tuplesort.c

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4141,67 +4141,8 @@ comparetup_index_hash(const SortTuple *a, const SortTuple *b,
41414141
static void
41424142
copytup_index(Tuplesortstate *state, SortTuple *stup, void *tup)
41434143
{
4144-
IndexTuple tuple = (IndexTuple) tup;
4145-
unsigned int tuplen = IndexTupleSize(tuple);
4146-
IndexTuple newtuple;
4147-
Datum original;
4148-
4149-
/* copy the tuple into sort storage */
4150-
newtuple = (IndexTuple) MemoryContextAlloc(state->tuplecontext, tuplen);
4151-
memcpy(newtuple, tuple, tuplen);
4152-
USEMEM(state, GetMemoryChunkSpace(newtuple));
4153-
stup->tuple = (void *) newtuple;
4154-
/* set up first-column key value */
4155-
original = index_getattr(newtuple,
4156-
1,
4157-
RelationGetDescr(state->indexRel),
4158-
&stup->isnull1);
4159-
4160-
if (!state->sortKeys->abbrev_converter || stup->isnull1)
4161-
{
4162-
/*
4163-
* Store ordinary Datum representation, or NULL value. If there is a
4164-
* converter it won't expect NULL values, and cost model is not
4165-
* required to account for NULL, so in that case we avoid calling
4166-
* converter and just set datum1 to zeroed representation (to be
4167-
* consistent, and to support cheap inequality tests for NULL
4168-
* abbreviated keys).
4169-
*/
4170-
stup->datum1 = original;
4171-
}
4172-
else if (!consider_abort_common(state))
4173-
{
4174-
/* Store abbreviated key representation */
4175-
stup->datum1 = state->sortKeys->abbrev_converter(original,
4176-
state->sortKeys);
4177-
}
4178-
else
4179-
{
4180-
/* Abort abbreviation */
4181-
int i;
4182-
4183-
stup->datum1 = original;
4184-
4185-
/*
4186-
* Set state to be consistent with never trying abbreviation.
4187-
*
4188-
* Alter datum1 representation in already-copied tuples, so as to
4189-
* ensure a consistent representation (current tuple was just
4190-
* handled). It does not matter if some dumped tuples are already
4191-
* sorted on tape, since serialized tuples lack abbreviated keys
4192-
* (TSS_BUILDRUNS state prevents control reaching here in any case).
4193-
*/
4194-
for (i = 0; i < state->memtupcount; i++)
4195-
{
4196-
SortTuple *mtup = &state->memtuples[i];
4197-
4198-
tuple = (IndexTuple) mtup->tuple;
4199-
mtup->datum1 = index_getattr(tuple,
4200-
1,
4201-
RelationGetDescr(state->indexRel),
4202-
&mtup->isnull1);
4203-
}
4204-
}
4144+
/* Not currently needed */
4145+
elog(ERROR, "copytup_index() should not be called");
42054146
}
42064147

42074148
static void

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy