diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-07-02 21:18:04 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-07-02 21:21:23 +0300 |
commit | 726117243022178e72966cbffdfb9147ec6dbbcc (patch) | |
tree | b2de814480de62ce84e634b12626b28e3d4cca41 | |
parent | a3fd7afe3090a5098f93408d47da70b47fb59e7b (diff) | |
download | postgresql-726117243022178e72966cbffdfb9147ec6dbbcc.tar.gz postgresql-726117243022178e72966cbffdfb9147ec6dbbcc.zip |
Remove obsolete heap_formtuple/modifytuple/deformtuple functions.
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
-rw-r--r-- | src/backend/access/common/heaptuple.c | 111 | ||||
-rw-r--r-- | src/include/access/htup_details.h | 11 |
2 files changed, 0 insertions, 122 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 09aea79c999..045e0a780b8 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -777,39 +777,6 @@ heap_form_tuple(TupleDesc tupleDescriptor, } /* - * 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. * @@ -880,44 +847,6 @@ heap_modify_tuple(HeapTuple tuple, } /* - * 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 * the inverse of heap_form_tuple. @@ -1025,46 +954,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 * into its Datum/isnull arrays. Data is extracted up through the diff --git a/src/include/access/htup_details.h b/src/include/access/htup_details.h index 55d483dfaf0..8dd530bd930 100644 --- a/src/include/access/htup_details.h +++ b/src/include/access/htup_details.h @@ -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); |