summaryrefslogtreecommitdiff
path: root/src/backend/access/heap/heaptoast.c
diff options
context:
space:
mode:
authorRobert Haas2019-10-04 18:24:46 +0000
committerRobert Haas2019-10-04 18:24:46 +0000
commit2e8b6bfa90b252b1e1758364de7deff067d6058a (patch)
tree107b305708ca634a760b52526b94aa1ed459c1c9 /src/backend/access/heap/heaptoast.c
parent61aa9f544a91f2908e4c7cd549907cdc5b6f1c82 (diff)
Rename some toasting functions based on whether they are heap-specific.
The old names for the attribute-detoasting functions names included the word "heap," which seems outdated now that the heap is only one of potentially many table access methods. On the other hand, toast_insert_or_update and toast_delete are heap-specific, so rename them by adding "heap_" as a prefix. Not all of the work of making the TOAST system fully accessible to AMs other than the heap is done yet, but there seems to be little harm in getting this renaming out of the way now. Commit 8b94dab06617ef80a0901ab103ebd8754427ef5a already divided up the functions among various files partially according to whether it was intended that they should be heap-specific or AM-agnostic, so this is just clarifying the division contemplated by that commit. Patch by me, reviewed and tested by Prabhat Sabu, Thomas Munro, Andres Freund, and Álvaro Herrera. Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com
Diffstat (limited to 'src/backend/access/heap/heaptoast.c')
-rw-r--r--src/backend/access/heap/heaptoast.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/backend/access/heap/heaptoast.c b/src/backend/access/heap/heaptoast.c
index fbf9294598a..dcfdee4467d 100644
--- a/src/backend/access/heap/heaptoast.c
+++ b/src/backend/access/heap/heaptoast.c
@@ -12,11 +12,11 @@
*
*
* INTERFACE ROUTINES
- * toast_insert_or_update -
+ * heap_toast_insert_or_update -
* Try to make a given tuple fit into one page by compressing
* or moving off attributes
*
- * toast_delete -
+ * heap_toast_delete -
* Reclaim toast storage when a tuple is deleted
*
*-------------------------------------------------------------------------
@@ -32,13 +32,13 @@
/* ----------
- * toast_delete -
+ * heap_toast_delete -
*
* Cascaded delete toast-entries on DELETE
* ----------
*/
void
-toast_delete(Relation rel, HeapTuple oldtup, bool is_speculative)
+heap_toast_delete(Relation rel, HeapTuple oldtup, bool is_speculative)
{
TupleDesc tupleDesc;
Datum toast_values[MaxHeapAttributeNumber];
@@ -73,7 +73,7 @@ toast_delete(Relation rel, HeapTuple oldtup, bool is_speculative)
/* ----------
- * toast_insert_or_update -
+ * heap_toast_insert_or_update -
*
* Delete no-longer-used toast-entries and create new ones to
* make the new tuple fit on INSERT or UPDATE
@@ -91,8 +91,8 @@ toast_delete(Relation rel, HeapTuple oldtup, bool is_speculative)
* ----------
*/
HeapTuple
-toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
- int options)
+heap_toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
+ int options)
{
HeapTuple result_tuple;
TupleDesc tupleDesc;
@@ -369,7 +369,7 @@ toast_flatten_tuple(HeapTuple tup, TupleDesc tupleDesc)
new_value = (struct varlena *) DatumGetPointer(toast_values[i]);
if (VARATT_IS_EXTERNAL(new_value))
{
- new_value = heap_tuple_fetch_attr(new_value);
+ new_value = detoast_external_attr(new_value);
toast_values[i] = PointerGetDatum(new_value);
toast_free[i] = true;
}
@@ -484,7 +484,7 @@ toast_flatten_tuple_to_datum(HeapTupleHeader tup,
if (VARATT_IS_EXTERNAL(new_value) ||
VARATT_IS_COMPRESSED(new_value))
{
- new_value = heap_tuple_untoast_attr(new_value);
+ new_value = detoast_attr(new_value);
toast_values[i] = PointerGetDatum(new_value);
toast_free[i] = true;
}
@@ -494,7 +494,8 @@ toast_flatten_tuple_to_datum(HeapTupleHeader tup,
/*
* Calculate the new size of the tuple.
*
- * This should match the reconstruction code in toast_insert_or_update.
+ * This should match the reconstruction code in
+ * heap_toast_insert_or_update.
*/
new_header_len = SizeofHeapTupleHeader;
if (has_nulls)
@@ -583,7 +584,7 @@ toast_build_flattened_tuple(TupleDesc tupleDesc,
new_value = (struct varlena *) DatumGetPointer(new_values[i]);
if (VARATT_IS_EXTERNAL(new_value))
{
- new_value = heap_tuple_fetch_attr(new_value);
+ new_value = detoast_external_attr(new_value);
new_values[i] = PointerGetDatum(new_value);
freeable_values[num_to_free++] = (Pointer) new_value;
}