Skip to content

Commit fdf472a

Browse files
author
Nikita Glukhov
committed
Fix compression and retoast of custom toast pointers
1 parent d5a568a commit fdf472a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/backend/access/table/toast_helper.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ toast_tuple_init(ToastTupleContext *ttc)
104104
* we reuse the original reference to the old value
105105
* in the new tuple.
106106
*/
107-
ttc->ttc_attr[i].tai_colflags |= TOASTCOL_IGNORE;
107+
if (VARATT_IS_EXTERNAL_ONDISK(new_value))
108+
ttc->ttc_attr[i].tai_colflags |= TOASTCOL_IGNORE;
109+
else
110+
ttc->ttc_attr[i].tai_size = VARSIZE_ANY(new_value);
111+
108112
continue;
109113
}
110114
else if (toaster && toaster->update_toast &&
@@ -276,7 +280,8 @@ toast_tuple_find_biggest_attribute(ToastTupleContext *ttc,
276280
continue;
277281
if (VARATT_IS_EXTERNAL(value) && !VARATT_IS_CUSTOM(value))
278282
continue; /* can't happen, toast_action would be PLAIN */
279-
if (for_compression && VARATT_IS_COMPRESSED(value))
283+
if (for_compression &&
284+
(VARATT_IS_COMPRESSED(value) || VARATT_IS_CUSTOM(value)))
280285
continue;
281286
if (check_main && att->attstorage != TYPSTORAGE_MAIN)
282287
continue;

0 commit comments

Comments
 (0)