Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7261172

Browse files
committed
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
1 parent a3fd7af commit 7261172

File tree

2 files changed

+0
-122
lines changed

2 files changed

+0
-122
lines changed

src/backend/access/common/heaptuple.c

-111
Original file line numberDiff line numberDiff line change
@@ -776,39 +776,6 @@ heap_form_tuple(TupleDesc tupleDescriptor,
776776
return tuple;
777777
}
778778

779-
/*
780-
* heap_formtuple
781-
*
782-
* construct a tuple from the given values[] and nulls[] arrays
783-
*
784-
* Null attributes are indicated by a 'n' in the appropriate byte
785-
* of nulls[]. Non-null attributes are indicated by a ' ' (space).
786-
*
787-
* OLD API with char 'n'/' ' convention for indicating nulls.
788-
* This is deprecated and should not be used in new code, but we keep it
789-
* around for use by old add-on modules.
790-
*/
791-
HeapTuple
792-
heap_formtuple(TupleDesc tupleDescriptor,
793-
Datum *values,
794-
char *nulls)
795-
{
796-
HeapTuple tuple; /* return tuple */
797-
int numberOfAttributes = tupleDescriptor->natts;
798-
bool *boolNulls = (bool *) palloc(numberOfAttributes * sizeof(bool));
799-
int i;
800-
801-
for (i = 0; i < numberOfAttributes; i++)
802-
boolNulls[i] = (nulls[i] == 'n');
803-
804-
tuple = heap_form_tuple(tupleDescriptor, values, boolNulls);
805-
806-
pfree(boolNulls);
807-
808-
return tuple;
809-
}
810-
811-
812779
/*
813780
* heap_modify_tuple
814781
* form a new tuple from an old tuple and a set of replacement values.
@@ -879,44 +846,6 @@ heap_modify_tuple(HeapTuple tuple,
879846
return newTuple;
880847
}
881848

882-
/*
883-
* heap_modifytuple
884-
*
885-
* forms a new tuple from an old tuple and a set of replacement values.
886-
* returns a new palloc'ed tuple.
887-
*
888-
* OLD API with char 'n'/' ' convention for indicating nulls, and
889-
* char 'r'/' ' convention for indicating whether to replace columns.
890-
* This is deprecated and should not be used in new code, but we keep it
891-
* around for use by old add-on modules.
892-
*/
893-
HeapTuple
894-
heap_modifytuple(HeapTuple tuple,
895-
TupleDesc tupleDesc,
896-
Datum *replValues,
897-
char *replNulls,
898-
char *replActions)
899-
{
900-
HeapTuple result;
901-
int numberOfAttributes = tupleDesc->natts;
902-
bool *boolNulls = (bool *) palloc(numberOfAttributes * sizeof(bool));
903-
bool *boolActions = (bool *) palloc(numberOfAttributes * sizeof(bool));
904-
int attnum;
905-
906-
for (attnum = 0; attnum < numberOfAttributes; attnum++)
907-
{
908-
boolNulls[attnum] = (replNulls[attnum] == 'n');
909-
boolActions[attnum] = (replActions[attnum] == 'r');
910-
}
911-
912-
result = heap_modify_tuple(tuple, tupleDesc, replValues, boolNulls, boolActions);
913-
914-
pfree(boolNulls);
915-
pfree(boolActions);
916-
917-
return result;
918-
}
919-
920849
/*
921850
* heap_deform_tuple
922851
* Given a tuple, extract data into values/isnull arrays; this is
@@ -1024,46 +953,6 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
1024953
}
1025954
}
1026955

1027-
/*
1028-
* heap_deformtuple
1029-
*
1030-
* Given a tuple, extract data into values/nulls arrays; this is
1031-
* the inverse of heap_formtuple.
1032-
*
1033-
* Storage for the values/nulls arrays is provided by the caller;
1034-
* it should be sized according to tupleDesc->natts not
1035-
* HeapTupleHeaderGetNatts(tuple->t_data).
1036-
*
1037-
* Note that for pass-by-reference datatypes, the pointer placed
1038-
* in the Datum will point into the given tuple.
1039-
*
1040-
* When all or most of a tuple's fields need to be extracted,
1041-
* this routine will be significantly quicker than a loop around
1042-
* heap_getattr; the loop will become O(N^2) as soon as any
1043-
* noncacheable attribute offsets are involved.
1044-
*
1045-
* OLD API with char 'n'/' ' convention for indicating nulls.
1046-
* This is deprecated and should not be used in new code, but we keep it
1047-
* around for use by old add-on modules.
1048-
*/
1049-
void
1050-
heap_deformtuple(HeapTuple tuple,
1051-
TupleDesc tupleDesc,
1052-
Datum *values,
1053-
char *nulls)
1054-
{
1055-
int natts = tupleDesc->natts;
1056-
bool *boolNulls = (bool *) palloc(natts * sizeof(bool));
1057-
int attnum;
1058-
1059-
heap_deform_tuple(tuple, tupleDesc, values, boolNulls);
1060-
1061-
for (attnum = 0; attnum < natts; attnum++)
1062-
nulls[attnum] = (boolNulls[attnum] ? 'n' : ' ');
1063-
1064-
pfree(boolNulls);
1065-
}
1066-
1067956
/*
1068957
* slot_deform_tuple
1069958
* Given a TupleTableSlot, extract data from the slot's physical tuple

src/include/access/htup_details.h

-11
Original file line numberDiff line numberDiff line change
@@ -782,17 +782,6 @@ extern HeapTuple heap_modify_tuple(HeapTuple tuple,
782782
bool *doReplace);
783783
extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
784784
Datum *values, bool *isnull);
785-
786-
/* these three are deprecated versions of the three above: */
787-
extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
788-
Datum *values, char *nulls);
789-
extern HeapTuple heap_modifytuple(HeapTuple tuple,
790-
TupleDesc tupleDesc,
791-
Datum *replValues,
792-
char *replNulls,
793-
char *replActions);
794-
extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc,
795-
Datum *values, char *nulls);
796785
extern void heap_freetuple(HeapTuple htup);
797786
extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor,
798787
Datum *values, bool *isnull);

0 commit comments

Comments
 (0)