Remove unused code from tuplesort.
authorAndres Freund <andres@anarazel.de>
Wed, 13 Nov 2019 23:57:01 +0000 (15:57 -0800)
committerAndres Freund <andres@anarazel.de>
Wed, 13 Nov 2019 23:57:01 +0000 (15:57 -0800)
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

src/backend/utils/sort/tuplesort.c

index a507bd249843d1231590d605e5819c31f7833cbe..7947d2bca0a3bdc0d07fb3ae0825af05193695fe 100644 (file)
@@ -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