Remove obsolete heap_formtuple/modifytuple/deformtuple functions.
authorHeikki Linnakangas <[email protected]>
Thu, 2 Jul 2015 18:18:04 +0000 (21:18 +0300)
committerHeikki Linnakangas <[email protected]>
Thu, 2 Jul 2015 18:21:23 +0000 (21:21 +0300)
These variants used the old-style 'n'/' ' NULL indicators. The new-style
functions have been available since version 8.1. That should be long enough
that if there is still any old external code using these functions, they
can just switch to the new functions without worrying about backwards
compatibility

Peter Geoghegan

src/backend/access/common/heaptuple.c
src/include/access/htup_details.h

index 09aea79c999282cdb0844a867a37c6add3d499d5..045e0a780b85482e0ecaebf1f17ab7d8535a265b 100644 (file)
@@ -776,39 +776,6 @@ heap_form_tuple(TupleDesc tupleDescriptor,
    return tuple;
 }
 
-/*
- *     heap_formtuple
- *
- *     construct a tuple from the given values[] and nulls[] arrays
- *
- *     Null attributes are indicated by a 'n' in the appropriate byte
- *     of nulls[]. Non-null attributes are indicated by a ' ' (space).
- *
- * OLD API with char 'n'/' ' convention for indicating nulls.
- * This is deprecated and should not be used in new code, but we keep it
- * around for use by old add-on modules.
- */
-HeapTuple
-heap_formtuple(TupleDesc tupleDescriptor,
-              Datum *values,
-              char *nulls)
-{
-   HeapTuple   tuple;          /* return tuple */
-   int         numberOfAttributes = tupleDescriptor->natts;
-   bool       *boolNulls = (bool *) palloc(numberOfAttributes * sizeof(bool));
-   int         i;
-
-   for (i = 0; i < numberOfAttributes; i++)
-       boolNulls[i] = (nulls[i] == 'n');
-
-   tuple = heap_form_tuple(tupleDescriptor, values, boolNulls);
-
-   pfree(boolNulls);
-
-   return tuple;
-}
-
-
 /*
  * heap_modify_tuple
  *     form a new tuple from an old tuple and a set of replacement values.
@@ -879,44 +846,6 @@ heap_modify_tuple(HeapTuple tuple,
    return newTuple;
 }
 
-/*
- *     heap_modifytuple
- *
- *     forms a new tuple from an old tuple and a set of replacement values.
- *     returns a new palloc'ed tuple.
- *
- * OLD API with char 'n'/' ' convention for indicating nulls, and
- * char 'r'/' ' convention for indicating whether to replace columns.
- * This is deprecated and should not be used in new code, but we keep it
- * around for use by old add-on modules.
- */
-HeapTuple
-heap_modifytuple(HeapTuple tuple,
-                TupleDesc tupleDesc,
-                Datum *replValues,
-                char *replNulls,
-                char *replActions)
-{
-   HeapTuple   result;
-   int         numberOfAttributes = tupleDesc->natts;
-   bool       *boolNulls = (bool *) palloc(numberOfAttributes * sizeof(bool));
-   bool       *boolActions = (bool *) palloc(numberOfAttributes * sizeof(bool));
-   int         attnum;
-
-   for (attnum = 0; attnum < numberOfAttributes; attnum++)
-   {
-       boolNulls[attnum] = (replNulls[attnum] == 'n');
-       boolActions[attnum] = (replActions[attnum] == 'r');
-   }
-
-   result = heap_modify_tuple(tuple, tupleDesc, replValues, boolNulls, boolActions);
-
-   pfree(boolNulls);
-   pfree(boolActions);
-
-   return result;
-}
-
 /*
  * heap_deform_tuple
  *     Given a tuple, extract data into values/isnull arrays; this is
@@ -1024,46 +953,6 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
    }
 }
 
-/*
- *     heap_deformtuple
- *
- *     Given a tuple, extract data into values/nulls arrays; this is
- *     the inverse of heap_formtuple.
- *
- *     Storage for the values/nulls arrays is provided by the caller;
- *     it should be sized according to tupleDesc->natts not
- *     HeapTupleHeaderGetNatts(tuple->t_data).
- *
- *     Note that for pass-by-reference datatypes, the pointer placed
- *     in the Datum will point into the given tuple.
- *
- *     When all or most of a tuple's fields need to be extracted,
- *     this routine will be significantly quicker than a loop around
- *     heap_getattr; the loop will become O(N^2) as soon as any
- *     noncacheable attribute offsets are involved.
- *
- * OLD API with char 'n'/' ' convention for indicating nulls.
- * This is deprecated and should not be used in new code, but we keep it
- * around for use by old add-on modules.
- */
-void
-heap_deformtuple(HeapTuple tuple,
-                TupleDesc tupleDesc,
-                Datum *values,
-                char *nulls)
-{
-   int         natts = tupleDesc->natts;
-   bool       *boolNulls = (bool *) palloc(natts * sizeof(bool));
-   int         attnum;
-
-   heap_deform_tuple(tuple, tupleDesc, values, boolNulls);
-
-   for (attnum = 0; attnum < natts; attnum++)
-       nulls[attnum] = (boolNulls[attnum] ? 'n' : ' ');
-
-   pfree(boolNulls);
-}
-
 /*
  * slot_deform_tuple
  *     Given a TupleTableSlot, extract data from the slot's physical tuple
index 55d483dfaf09e71782d39bfa8b0acdfc728a394d..8dd530bd930f1d23f19f36e17112f47c9c498f21 100644 (file)
@@ -782,17 +782,6 @@ extern HeapTuple heap_modify_tuple(HeapTuple tuple,
                  bool *doReplace);
 extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
                  Datum *values, bool *isnull);
-
-/* these three are deprecated versions of the three above: */
-extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
-              Datum *values, char *nulls);
-extern HeapTuple heap_modifytuple(HeapTuple tuple,
-                TupleDesc tupleDesc,
-                Datum *replValues,
-                char *replNulls,
-                char *replActions);
-extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc,
-                Datum *values, char *nulls);
 extern void heap_freetuple(HeapTuple htup);
 extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor,
                        Datum *values, bool *isnull);